-
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 2.43 KB
/
Copy pathdeploy.yml
File metadata and controls
91 lines (77 loc) · 2.43 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
82
83
84
85
86
87
88
89
90
91
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build & Deploy Blog
on:
push:
branches:
- main
workflow_dispatch: # 수동 실행 허용
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# 1. 저장소 체크아웃
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# 2. Node.js 설정 (이미지 최적화용)
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
# 3. Node 의존성 설치
- name: Install Node Dependencies
run: npm ci
# 4. 이미지 최적화 (PNG/JPG → WebP + 다중 해상도)
- name: Optimize Images
run: npm run optimize-images -- --all
continue-on-error: true # 이미지 없어도 빌드 계속
# 5. 마크다운 이미지 → <picture> 태그 변환
- name: Convert to Picture Tags
run: npm run convert-to-picture
# 5.5. 변환 결과 커밋 (원본 삭제 + picture 태그 정리)
- name: Commit optimized images
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A static/img/posts/ _posts/
if git diff --staged --quiet; then
echo "No image changes to commit"
else
git commit -m "chore: WebP 변환 및 원본 이미지 정리 [skip ci]"
git push
fi
# 6. Ruby 설정 (Jekyll 빌드용)
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
# 7. Jekyll 빌드
- name: Build Jekyll Site
run: bundle exec jekyll build --future
env:
JEKYLL_ENV: production
# 8. GitHub Pages 설정
- name: Setup Pages
uses: actions/configure-pages@v4
# 9. 빌드 결과물 업로드
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: '_site'
# 10. GitHub Pages 배포
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4