This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
generated from JupiterOne-Archives/integration-template
-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (82 loc) · 2.57 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Build
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- id: setup-node
name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Check out code repository source code
uses: actions/checkout@v2
- name: Install dependencies
run: yarn
- name: Run tests
run: yarn test:ci
- name: Run build
run: yarn build
# Publishing is done in a separate job to allow
# for all matrix builds to complete.
release:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 2
# Fetch tags and describe the commit before the merge commit
# to see if it's a version publish
- name: Fetch tags
run: |
git fetch --tags
if git describe --exact-match --match "v*.*.*" HEAD^2
then
echo "Found version commit tag. Publishing."
echo "publish=true" >> $GITHUB_ENV
echo "VERSION_NUM=`echo $(git describe --tags --abbrev=0 | sed -e "s/v//gI")`" >> $GITHUB_ENV
else
echo "Version commit tag not found. Not publishing."
fi
- name: Publish
if: env.publish == 'true'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
yarn
yarn build
npm publish ./dist
- name: Get Version Changelog Entry
if: env.publish == 'true'
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ env.VERSION_NUM }}
path: ./CHANGELOG.md
continue-on-error: true
- name: Create Release
if: env.publish == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}
release_name: Release ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease:
${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
continue-on-error: true