Check external data sources #372889
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: Check external data sources | |
| on: | |
| workflow_dispatch: | |
| concurrency: | |
| group: publish | |
| jobs: | |
| check: | |
| outputs: | |
| diff: ${{ steps.diff.outputs.diff }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: haliphax/haliphax-dot-dev/.github@main | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| key: external-data-${{ github.run_id }} | |
| path: 11ty/data/external | |
| restore-keys: external-data- | |
| - id: diff | |
| name: Check sources | |
| env: | |
| TWITCH_CLIENT_ID: ${{ secrets.TWITCH_CLIENT_ID }} | |
| TWITCH_CLIENT_SECRET: ${{ secrets.TWITCH_CLIENT_SECRET }} | |
| TWITCH_USERNAME: ${{ secrets.TWITCH_USERNAME }} | |
| YT_API_KEY: ${{ secrets.YT_API_KEY }} | |
| run: | | |
| # compare API response with locally cached JSON data | |
| npm run build:ts | |
| diff=0 | |
| npm run check || diff=1 | |
| echo "diff=$diff" >> "$GITHUB_OUTPUT" | |
| - uses: actions/cache/save@v4 | |
| with: | |
| key: external-data-${{ github.run_id }} | |
| path: 11ty/data/external | |
| - if: steps.diff.outputs.diff == '1' | |
| name: Build site | |
| run: npm run build:11ty | |
| - if: steps.diff.outputs.diff == '1' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/ | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: check | |
| if: needs.check.outputs.diff == '1' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |