-
Notifications
You must be signed in to change notification settings - Fork 25
71 lines (62 loc) · 2.44 KB
/
Copy pathdeploy-github-pages.yml
File metadata and controls
71 lines (62 loc) · 2.44 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
name: Deployment to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
jobs:
deploy:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write
pages: write
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
# package.json의 hugo-extended 버전과 맞춘다 — 'latest'였을 땐 로컬 빌드와 버전이
# 어긋나 프로덕션 빌드가 재현되지 않고, Hugo가 올라갈 때마다 예고 없이 깨질 수 있었다.
hugo-version: '0.164.0'
extended: true
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- run: npm ci
- name: Build slides (Slidev)
working-directory: docs/slides/v6
run: |
npm ci
npm run build
# Hugo 이미지 변환 결과(resources/_gen) 캐싱 — 콜드 빌드 이미지 재처리 방지.
# 매 커밋(sha)마다 새로 저장하고, restore-keys 로 직전 캐시를 복원해 변경분만 재처리한다.
- name: Cache Hugo resources
uses: actions/cache@v5
with:
path: resources/_gen
key: hugo-resources-${{ runner.os }}-${{ github.sha }}
restore-keys: |
hugo-resources-${{ runner.os }}-
# baseURL은 hugo.toml 값을 그대로 쓴다. REPO_OWNER(=github.repository_owner)로 덮어쓰면
# 실제 서빙 호스트(소문자 openchain-project.github.io)와 대소문자가 달라져 sitemap·canonical·
# og:url이 서로 다른 표기 3종으로 흩어졌다.
- run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# force_orphan: 배포마다 새 커밋을 쌓지 않고 매번 커밋 1개로 새로 만든다.
# 원래 옵션이 없어 gh-pages에 배포 이력 913개(빌드 산출물 전체 중복)가 쌓여
# 저장소 용량의 큰 부분을 차지했다. gh-pages는 순수 빌드 산출물이라 이력을
# 보존할 이유가 없다.
force_orphan: true