Repository navigation
62 lines (57 loc) · 2.14 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
62 lines (57 loc) · 2.14 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
name: Deploy Docs
on:
push:
branches: [main]
paths:
- 'docs/**'
workflow_dispatch:
# 워크플로 기본 권한은 읽기 전용으로 두고, 필요한 권한은 잡 단위로만 부여한다.
permissions:
contents: read
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
# build 잡은 npm ci / docs:build 로 서드파티 코드를 실행하므로 쓰기·OIDC 권한을 주지 않는다.
# pages: read 는 configure-pages 가 Pages 사이트 정보(GET /repos/{owner}/{repo}/pages)를 조회하는 데 필요하다.
permissions:
contents: read
pages: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
with:
# VitePress lastUpdated 계산용 전체 히스토리. 이후 push 가 없으므로 토큰을 .git/config 에 남기지 않는다.
fetch-depth: 0
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24'
cache: npm
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Install dependencies
run: npm ci
- name: Build with VitePress
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: docs/.vitepress/dist
deploy:
needs: build
# push 트리거는 main 전용이지만 workflow_dispatch 는 아무 브랜치에서나 가능하므로 배포는 main 만 허용한다
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# actions/deploy-pages 가 요구하는 최소 권한만 배포 잡에 부여한다.
permissions:
pages: write # Pages 배포 생성
id-token: write # 배포 출처 검증용 OIDC 토큰 발급
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
environment: docs