-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (52 loc) · 1.65 KB
/
ci.yaml
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: test, build, publish
on:
- push
- workflow_dispatch
jobs:
ci:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: install dependencies
run: npm ci
- name: build
run: npm run build
- if: github.ref == 'refs/heads/master'
name: publish on npmjs.org
run: |
if jq --null-input --exit-status \
--argjson local "$(jq .version package.json)" \
--argjson published "$(npm view --json @navikt/bedriftsmeny versions)" \
'$published | map(. == $local) | any'
then
echo "Version already published. Nothing to do."
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://npm.pkg.github.com'
- if: github.ref == 'refs/heads/master'
name: publish on github
run: |
if jq --null-input --exit-status \
--argjson local "$(jq .version package.json)" \
--argjson published "$(npm view --json @navikt/bedriftsmeny versions)" \
'$published | map(. == $local) | any'
then
echo "Version already published. Nothing to do."
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}