|
1 | 1 | name: Deploy to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [main] |
6 | | - workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + workflow_dispatch: |
7 | 7 |
|
8 | 8 | permissions: |
9 | | - contents: read |
10 | | - pages: write |
11 | | - id-token: write |
| 9 | + contents: read |
| 10 | + pages: write |
| 11 | + id-token: write |
12 | 12 |
|
13 | 13 | concurrency: |
14 | | - group: pages |
15 | | - cancel-in-progress: false |
| 14 | + group: pages |
| 15 | + cancel-in-progress: false |
16 | 16 |
|
17 | 17 | jobs: |
18 | | - build: |
19 | | - runs-on: ubuntu-latest |
20 | | - steps: |
21 | | - - name: Checkout |
22 | | - uses: actions/checkout@v4 |
23 | | - with: |
24 | | - fetch-depth: 0 |
25 | | - - name: Setup Node |
26 | | - uses: actions/setup-node@v4 |
27 | | - with: |
28 | | - node-version: 22 |
29 | | - cache: yarn |
30 | | - - name: Setup Pages |
31 | | - uses: actions/configure-pages@v4 |
32 | | - |
33 | | - - name: Install dependencies |
34 | | - run: yarn install --frozen-lockfile |
35 | | - |
36 | | - - name: Build with VitePress |
37 | | - run: npm run docs:build |
38 | | - |
39 | | - - name: Upload artifact |
40 | | - uses: actions/upload-pages-artifact@v3 |
41 | | - with: |
42 | | - path: .vitepress/dist |
43 | | - |
44 | | - deploy: |
45 | | - environment: |
46 | | - name: github-pages |
47 | | - url: ${{ steps.deployment.outputs.page_url }} |
48 | | - needs: build |
49 | | - runs-on: ubuntu-latest |
50 | | - name: Deploy |
51 | | - steps: |
52 | | - - name: Deploy to GitHub Pages |
53 | | - id: deployment |
54 | | - uses: actions/deploy-pages@v4 |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + - name: Setup Node |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: 22 |
| 29 | + cache: yarn |
| 30 | + |
| 31 | + - name: Cache optimized images |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: | |
| 35 | + contents/posts/**/img/**/*.webp |
| 36 | + contents/posts/**/img/**/*.jpeg |
| 37 | + key: optimized-images-${{ hashFiles('contents/posts/**/img/**/*.{jpg,jpeg,png}') }} |
| 38 | + restore-keys: | |
| 39 | + optimized-images- |
| 40 | +
|
| 41 | + - name: Setup Pages |
| 42 | + uses: actions/configure-pages@v4 |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: yarn install --frozen-lockfile |
| 46 | + |
| 47 | + - name: Build with VitePress |
| 48 | + run: npm run docs:build |
| 49 | + |
| 50 | + - name: Upload artifact |
| 51 | + uses: actions/upload-pages-artifact@v3 |
| 52 | + with: |
| 53 | + path: .vitepress/dist |
| 54 | + |
| 55 | + deploy: |
| 56 | + environment: |
| 57 | + name: github-pages |
| 58 | + url: ${{ steps.deployment.outputs.page_url }} |
| 59 | + needs: build |
| 60 | + runs-on: ubuntu-latest |
| 61 | + name: Deploy |
| 62 | + steps: |
| 63 | + - name: Deploy to GitHub Pages |
| 64 | + id: deployment |
| 65 | + uses: actions/deploy-pages@v4 |
0 commit comments