generated from parzh/package-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (76 loc) · 2.19 KB
/
publish-xml-updates.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
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Publish XML updates
on:
workflow_dispatch: # manually (via GitHub UI)
schedule:
- cron: "0 10 * * 5" # every Friday at 10:00
jobs:
get-curr:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
# Using '--force' to bypass self-dependency error
- run: npm i --no-save --force iso4217-json@npm:@iso4217/json@latest
- uses: actions/upload-artifact@v2
with:
name: curr
path: node_modules/iso4217-json/data.json
get-next:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: npm ci
- run: npm run build-data-file
- uses: actions/upload-artifact@v2
with:
name: next
path: data.json
compare:
runs-on: ubuntu-20.04
needs:
- get-curr
- get-next
outputs:
winner: ${{ steps.s1.outputs.o1 }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: curr
- uses: actions/download-artifact@v2
with:
name: next
path: next
- id: s1
name: Determine which file to use
run: |2
if cmp -s curr/data.json next/data.json
then
echo Data is the same, no update is needed
echo "::set-output name=o1::curr"
else
echo Data has changed, an update is required
echo "::set-output name=o1::next"
fi
publish:
runs-on: ubuntu-20.04
needs: compare
if: ${{ needs.compare.outputs.winner == 'next' }}
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PARZHBOT_PAT }}
- uses: actions/download-artifact@v2
with:
name: next
- name: Set Git user name and email
run: |2
git config --global user.name 'parzhbot'
git config --global user.email '59538037+parzhbot@users.noreply.github.com'
- run: npm ci
- run: npm run v:ci
- name: Publish to registry
run: |2
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > .npmrc
npm publish --tag next
# TODO: change tag to "latest"
- run: git push --follow-tags