-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (69 loc) · 2.23 KB
/
update.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
name: Update WQX
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 6'
permissions:
contents: write
jobs:
update:
name: Update
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js 20.x
uses: actions/setup-node@master
with:
node-version: 20.x
- name: Create .npmrc
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use npm 8
run: |
npm install -g npm@8
- name: Install dependencies
run: |
npm install
- name: Download and rebuild allowed values
run: |
npm run download
npm run build
npm run lint
- name: Check for file changes
run: |
git status --porcelain
echo "change=$(git status --porcelain | wc -l)" >> $GITHUB_ENV
- if: env.change != 0
name: Commit & push changes
run: |
git config --local user.name ${{ github.actor }}
git config --local user.email [email protected]
git add -A
git commit -a -m 'ci: update allowed values'
npm version patch -m 'chore: bump version to %s'
git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:${GITHUB_REF#refs/*/} --follow-tags --force --tags
- if: env.change != 0
name: Publish
run: |
cp package.json dist/package.json
npm publish ./dist
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# -
# if: env.change != 0
# name: Trigger @gordonfn/data-schema rebuild
# run: |
# curl -X POST https://api.github.com/repos/gordonfn/schema/dispatches \
# -H 'Accept: application/vnd.github.everest-preview+json' \
# -u ${{ secrets.GITHUB_TOKEN }} \
# --data '{"event_type": "wqx", "client_payload": {}'