-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (63 loc) · 1.9 KB
/
versionbump.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
name: Bump NPM Version and draft release
on:
push:
branches:
- master
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'gifs.json'
jobs:
build:
runs-on: ubuntu-latest
outputs:
nodeVersion: ${{ steps.bump_version.outputs.version }}
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: yarn test
run: |
yarn
yarn test
env:
CI: true
- name: update cache
run: |
yarn build:cache
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git diff-index --quiet HEAD || git commit -m "updating cache"
git push
- name: bump version
id: bump_version
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
echo "::set-output name=version::$(echo $(node -p "require('./package.json').version.trim()"))"
yarn version --patch
git push
release:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [16.x]
steps:
- name: draft release
id: draft_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nodeVersion }}
release_name: Release ${{ needs.build.outputs.nodeVersion }}
body: |
Releasing version ${{ needs.build.outputs.nodeVersion }} to NPM
draft: true # Once tested this can be switched to false to immediately release to NPM
prerelease: false