Skip to content

Adds workflow script and yml for updating downstream browsers #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
57 changes: 57 additions & 0 deletions .github/workflows/refresh_downstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
package-lock.json
dist/
dist/
package/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "rm -rf dist; prettier . --write; tsc"
"prepare": "rm -rf dist; prettier . --write; tsc",
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts"
},
"license": "Apache-2.0",
"dependencies": {
Expand Down
21 changes: 0 additions & 21 deletions package/CONTRIBUTING.md

This file was deleted.

201 changes: 0 additions & 201 deletions package/LICENSE.txt

This file was deleted.

Loading