generated from parzh/package-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (54 loc) · 1.52 KB
/
publish-new-tag.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: Publish new tag
on:
push:
tags:
- '*'
jobs:
check-version-match:
name: Check versions in package* files match
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: |2
node -e "process.exit(require('./package.json').version !== require('./package-lock.json').version)"
check-version-new:
name: Check this version is brand new
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: |2
set -e
incoming_version=$(node -pe "require('./package.json').version;")
if [ ! -z "$(npm view @iso4217/json@$incoming_version version)" ]; then
echo "This version ($incoming_version) is already published; please, update version by running 'npm version <version>'"
exit 1
fi
test:
name: Run tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npm t
publish:
name: Publish this version
runs-on: ubuntu-20.04
needs:
- check-version-match
- check-version-new
# TODO: - tests
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: |2
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_AUTH_TOKEN}}" > .npmrc
npm publish --tag latest