|
1 | | -name: deploy github pages |
| 1 | +name: Deploy GitHub Pages |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: |
5 | 6 | - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pages: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: pages |
| 16 | + cancel-in-progress: true |
6 | 17 |
|
7 | 18 | jobs: |
8 | | - Build: |
| 19 | + build: |
9 | 20 | runs-on: ubuntu-latest |
| 21 | + |
10 | 22 | steps: |
11 | | - - name: checkout code |
12 | | - uses: actions/checkout@v3 |
13 | | - - name: actions/setup-node@v3 |
14 | | - uses: actions/setup-node@v3 |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v5 |
| 25 | + |
| 26 | + - name: Configure GitHub Pages |
| 27 | + uses: actions/configure-pages@v5 |
| 28 | + |
| 29 | + - name: Setup Node.js |
| 30 | + uses: actions/setup-node@v6 |
15 | 31 | with: |
16 | | - node-version: '16.14' |
| 32 | + node-version: 22 |
17 | 33 | cache: yarn |
18 | | - cache-dependency-path: '**/yarn.lock' |
19 | | - - name: yarn cache |
20 | | - id: yarn-cache-dir-path |
21 | | - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT |
22 | | - - uses: actions/cache@v3 |
23 | | - id: yarn-cache |
24 | | - with: |
25 | | - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
26 | | - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
27 | | - restore-keys: | |
28 | | - ${{ runner.os }}-yarn- |
29 | | - - run: yarn install --frozen-lockfile && yarn build |
30 | | - - name: upload dist |
31 | | - uses: actions/upload-artifact@v3 |
| 34 | + cache-dependency-path: yarn.lock |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + run: yarn install --frozen-lockfile |
| 38 | + |
| 39 | + - name: Build site |
| 40 | + run: yarn build |
| 41 | + |
| 42 | + - name: Upload Pages artifact |
| 43 | + uses: actions/upload-pages-artifact@v5 |
32 | 44 | with: |
33 | | - name: build-pages |
34 | 45 | path: dist |
35 | | - retention-days: 1 |
36 | 46 |
|
37 | | - Deploy: |
38 | | - needs: Build |
| 47 | + deploy: |
| 48 | + needs: build |
39 | 49 | runs-on: ubuntu-latest |
| 50 | + environment: |
| 51 | + name: github-pages |
| 52 | + url: ${{ steps.deployment.outputs.page_url }} |
| 53 | + |
40 | 54 | steps: |
41 | | - - name: checkout code |
42 | | - uses: actions/checkout@v3 |
43 | | - - name: download build files |
44 | | - uses: actions/download-artifact@v3 |
45 | | - with: |
46 | | - name: build-pages |
47 | | - path: dist |
48 | | - - name: deploy |
49 | | - uses: JamesIves/github-pages-deploy-action@v4.4.1 |
50 | | - with: |
51 | | - branch: gh-pages |
52 | | - folder: dist |
| 55 | + - name: Deploy to GitHub Pages |
| 56 | + id: deployment |
| 57 | + uses: actions/deploy-pages@v4 |
0 commit comments