-
Notifications
You must be signed in to change notification settings - Fork 3
39 lines (32 loc) · 1.33 KB
/
deploy-data.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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"