Skip to content

Commit 4eeb15f

Browse files
authored
Merge pull request #1 from web-platform-dx/add-workflows
Adds workflow script and yml for updating downstream browsers
2 parents aee1183 + ce25d4b commit 4eeb15f

File tree

9 files changed

+282
-459
lines changed

9 files changed

+282
-459
lines changed

.DS_Store

0 Bytes
Binary file not shown.
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Refresh downstream-browsers.json
2+
3+
on:
4+
schedule:
5+
- cron: "0 14 * * *"
6+
workflow_dispatch:
7+
8+
env:
9+
package_dir: "/"
10+
11+
jobs:
12+
refresh-downstream-browsers-json:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: "16"
23+
registry-url: "https://registry.npmjs.org"
24+
25+
- name: Install environment
26+
run: npm ci
27+
28+
- name: Run refresh-downstream.ts
29+
id: refresh-downstream-script
30+
run: |
31+
npm run refresh-downstream ${{ secrets.USERAGENTSIOKEY }}
32+
if [[ -n "$(git diff)" ]]; then
33+
echo "changes-available=TRUE" >> $GITHUB_OUTPUT
34+
else
35+
echo "changes-available=FALSE" >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Publish new version to NPM
39+
if: steps.refresh-downstream-script.outputs.changes-available == 'TRUE'
40+
id: publish-to-npm
41+
run: |
42+
echo "publishing"
43+
npm run prepare
44+
npm publish --provenance --access public
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
48+
- name: Push changes to main
49+
if: steps.publish-to-npm.outcome == 'success'
50+
id: push-to-main
51+
run: |
52+
echo "changes have occurred, committing to main"
53+
git config --global user.name 'github-actions[bot]'
54+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
55+
git add .
56+
git commit -m 'Updating downstream-browsers'
57+
git push origin main

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
package-lock.json
3-
dist/
3+
dist/
4+
package/

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"type": "module",
1616
"scripts": {
1717
"test": "echo \"Error: no test specified\" && exit 1",
18-
"prepare": "rm -rf dist; prettier . --write; tsc"
18+
"prepare": "rm -rf dist; prettier . --write; tsc",
19+
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts"
1920
},
2021
"license": "Apache-2.0",
2122
"dependencies": {

package/CONTRIBUTING.md

-21
This file was deleted.

package/LICENSE.txt

-201
This file was deleted.

0 commit comments

Comments
 (0)