-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (47 loc) · 1.5 KB
/
publish.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
name: test + publish
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
- run: yarn
- run: yarn lint
publish-npm:
if: contains(github.ref, 'master')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
- run: yarn
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-github-package:
if: contains(github.ref, 'master')
needs: publish-npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
token: ${{ secrets.GH_TOKEN }}
- run: |
git config --global user.name 'competec-mgw-bot'
git config --global user.email 'competec-mgw-bot@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout "${GITHUB_REF:11}"
git pull
if [[ "$(git log -1 --pretty=%B)" =~ "chore(RELEASE):" ]]; then npm config set access public && npm publish --access public; fi
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}