generated from parzh/package-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (80 loc) · 2.26 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
82
83
84
85
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@v3
- uses: actions/setup-node@v3
with:
node-version: 18
# Using '--force' to bypass self-dependency error
- run: npm i --no-save --force iso4217-json@npm:@iso4217/json@latest
- uses: actions/upload-artifact@v3
with:
name: curr
path: node_modules/iso4217-json/data.json
get-next:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm run build-data-file
- uses: actions/upload-artifact@v3
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@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/download-artifact@v3
with:
name: curr
path: curr
- uses: actions/download-artifact@v3
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@v3
with:
token: ${{secrets.PARZHBOT_PAT}}
- name: Set Git user name and email
run: |2
git config --global user.name 'parzhbot'
git config --global user.email '[email protected]'
- run: npm ci
- run: npm version --git-tag-version $(npm run --silent compose-version-number:ci)
env:
VERSIONING_IS_ALLOWED: "true"
- run: git push --follow-tags