Repository navigation
63 lines (55 loc) · 1.81 KB
/
Copy pathdeploy-pages.yml
File metadata and controls
63 lines (55 loc) · 1.81 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Deploy book to GitHub Pages
# Builds the static site from content/ with site/generate.py and publishes it to the
# gh-pages branch, which GitHub Pages serves (legacy branch source) at the custom
# domain aw.isainative.dev. The committed images (cover, og-image, icons) ship as-is.
on:
push:
branches: [main]
paths:
- "site/**"
- "content/**"
- "examples/**"
- "assets/**"
- "scripts/**"
- "analytics/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/deploy-pages.yml"
- ".github/workflows/validate-book.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-gh-pages
cancel-in-progress: true
jobs:
validate:
uses: ./.github/workflows/validate-book.yml
with:
artifact-name: validated-pages
deploy:
needs: validate
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download the validated site and analytics beacon
uses: actions/download-artifact@v4
with:
name: validated-pages
path: artifact
- name: Remove the gated PDF from the public site
run: rm -f artifact/site/gh-aw-book.pdf
- name: Publish the validated site to gh-pages
run: |
cd artifact/site
touch .nojekyll
git init -q -b gh-pages
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -q -m "Deploy ${SOURCE_SHA} from ${GITHUB_REF_NAME}"
git push -q --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_SHA: ${{ needs.validate.outputs.source-sha }}