-
Notifications
You must be signed in to change notification settings - Fork 7
61 lines (51 loc) · 1.46 KB
/
deploy.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
name: Deploy
on:
push:
branches: [ 'develop', 'master' ]
pull_request:
branches: [ 'develop', 'master' ]
jobs:
cancel-previous:
name: 'Cancel Previous Runs'
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}
deploy:
runs-on: ubuntu-latest
needs: cancel-previous
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2-beta
with:
node-version: '10.22.0'
registry-url: https://registry.npmjs.org/
- name: Configure Git
run: |
git reset --hard
git fetch origin master:master
- name: Set npm credentials
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> $HOME/.npmrc
- name: Install package
run: npm ci
- name: Build package
run: npm run build
- name: Test
run: npm run test:prod
- name: Deploy on develop branch
if: github.ref == 'refs/heads/develop'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Deploy on master branch
if: github.ref == 'refs/heads/master'
run: |
npx semantic-release
git checkout develop
git merge origin/master
git push origin develop