Skip to content

Commit 587d710

Browse files
committed
Refactor GitHub Actions workflow to separate build and deploy jobs, update permissions, and improve caching for Node.js setup
1 parent 0f90e1b commit 587d710

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

.github/workflows/deploy.yml

+29-16
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,47 @@ on:
66
workflow_dispatch:
77

88
permissions:
9-
contents: write
9+
contents: read
1010
pages: write
1111
id-token: write
1212

1313
jobs:
14-
build-and-deploy:
14+
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- name: Checkout
18+
uses: actions/checkout@v3
1819

19-
- uses: actions/setup-node@v3
20+
- name: Setup Node
21+
uses: actions/setup-node@v3
2022
with:
21-
node-version: 20
22-
23+
node-version: '20'
24+
cache: 'npm'
25+
2326
- name: Install dependencies
2427
run: npm ci
25-
28+
2629
- name: Build
2730
run: npm run build
28-
31+
2932
- name: Add .nojekyll file
3033
run: touch ./dist/.nojekyll
31-
32-
- name: Deploy
33-
uses: JamesIves/github-pages-deploy-action@v4
34+
35+
- name: Setup Pages
36+
uses: actions/configure-pages@v3
37+
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v2
3440
with:
35-
folder: dist
36-
branch: gh-pages
37-
# The following line ensures proper MIME types
38-
clean-exclude: |
39-
.nojekyll
41+
path: './dist'
42+
43+
deploy:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
steps:
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)