Repository navigation
81 lines (68 loc) · 2.21 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
81 lines (68 loc) · 2.21 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: deploy-docs
# Builds the static site and publishes it to the gh-pages branch, which is what
# GitHub Pages serves at docs.giveth.io.
#
# The build reads content/ from the repo and never contacts Notion. Refreshing
# that content is refresh-content.yml's job; a push it makes lands here.
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
concurrency:
group: deploy-docs
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- run: npm ci
- name: Build static site
run: npm run build
- name: Check every live URL was generated
run: node scripts/check-export.mjs
- name: Check hosted videos and files are reachable
# Warns rather than fails: a missing video should not hold back a text
# fix. refresh-content is where a missing upload actually blocks.
if: github.event_name != 'pull_request'
run: scripts/sync-media.sh --verify || echo "::warning::Some hosted files are not on the Space. Run refresh-content."
- name: Upload build
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: site
path: out
retention-days: 3
publish:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: site
path: out
- name: Publish to gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
cd out
touch .nojekyll
git init -q
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 ${GITHUB_SHA::7}"
git push -q --force \
"https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
HEAD:gh-pages