Merge pull request #419 from jwin-mm/patch-39 #4
This file contains 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: Validate/Deploy Data | |
on: | |
push: {branches: [master]} | |
jobs: | |
validate-then-deploy: | |
name: Validate, then deploy data | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jdx/mise-action@v2 | |
- run: npm ci | |
- run: mise run validate | |
# Having validated the data, we now prepare a bundle. This script creates | |
# files in a docs/ directory. | |
- run: mise run bundle-data | |
# Notes: actions/checkout@v2 no longer fetches entire history nor enters | |
# detached HEAD state. We really just need to check out an (orphaned) | |
# branch and then add, commit, and push the appropriate directory. | |
- name: Commit the data | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git checkout --orphan "gh-pages-$GITHUB_SHA" | |
git --work-tree=docs add . | |
git commit -m "Automated data deployment at $(date -Is)" | |
git show --stat HEAD | |
# If the previous commit successfully happened, download the latest state | |
# of the remote branch gh-pages. | |
- name: Deploy the data | |
run: | | |
git fetch --prune --unshallow origin gh-pages | |
git push --force-with-lease origin "gh-pages-$GITHUB_SHA:gh-pages" |