-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (48 loc) · 1.56 KB
/
refresh_downstream.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
name: Refresh downstream-browsers.json
on:
schedule:
- cron: "0 14 * * *"
workflow_dispatch:
env:
package_dir: "/"
jobs:
refresh-downstream-browsers-json:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- name: Install environment
run: npm ci
- name: Run refresh-downstream.ts
id: refresh-downstream-script
run: |
npm run refresh-downstream ${{ secrets.USERAGENTSIOKEY }}
if [[ -n "$(git diff)" ]]; then
echo "changes-available=TRUE" >> $GITHUB_OUTPUT
else
echo "changes-available=FALSE" >> $GITHUB_OUTPUT
fi
- name: Publish new version to NPM
if: steps.refresh-downstream-script.outputs.changes-available == 'TRUE'
id: publish-to-npm
run: |
echo "publishing"
npm run prepare
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push changes to main
if: steps.publish-to-npm.outcome == 'success'
id: push-to-main
run: |
echo "changes have occurred, committing to main"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m 'Updating downstream-browsers'
git push origin main