-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.86 KB
/
release.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
name: Release
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out the branch
uses: actions/checkout@v2
- name: Check if version was updated
id: version_check
uses: EndBug/version-check@master
with:
diff-search: true # searches all commit diffs if SemVer not included in commit message
- name: No update detected
if: steps.version_check.outputs.changed != 'true'
run: 'echo "No update detected! Shutting down..."' # Shut down if no version update
- name: Version update detected
if: steps.version_check.outputs.changed == 'true'
run: 'echo "Version change found! New ${{ steps.version_check.outputs.type }} version: ${{ steps.version_check.outputs.version }}"'
- name: Read .nvmrc
if: steps.version_check.outputs.changed == 'true'
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Setup node
if: steps.version_check.outputs.changed == 'true'
uses: actions/setup-node@v1
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
if: steps.version_check.outputs.changed == 'true'
run: npm ci
- name: Publish package to NPM
if: steps.version_check.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create release
if: steps.version_check.outputs.changed == 'true'
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version_check.outputs.version }}
release_name: Release v${{ steps.version_check.outputs.version }}