Refresh static assets #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Refresh static resources | |
| on: | |
| schedule: | |
| - cron: "0 16 * * *" | |
| 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: "22" | |
| 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-static | |
| if [[ -n "$(git diff)" ]]; then | |
| echo "changes-available=TRUE" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes-available=FALSE" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Push changes to main | |
| if: steps.refresh-downstream-script.outputs.changes-available == 'TRUE' | |
| 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' | |
| npm run prepare | |
| git add . | |
| git commit -m 'Updating static site' | |
| git push origin main |