Skip to content

Commit 605705c

Browse files
committed
revert
1 parent aab21a9 commit 605705c

File tree

1 file changed

+40
-31
lines changed

1 file changed

+40
-31
lines changed

.github/workflows/deploy.yml

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,58 @@
1-
name: Deploy
1+
name: Deploy Vite to GitHub Pages
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
716

817
jobs:
918
build:
10-
name: Build
1119
runs-on: ubuntu-latest
12-
1320
steps:
14-
- name: Checkout repo
15-
uses: actions/checkout@v4
16-
17-
- name: Setup Node
18-
uses: actions/setup-node@v4
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: "npm"
26+
27+
- name: Install deps
28+
run: |
29+
if [ -f package-lock.json ]; then
30+
npm ci
31+
else
32+
npm install
33+
fi
34+
35+
- name: Build
36+
env: { CI: false }
37+
run: npm run build
1938

20-
- name: Install dependencies
21-
uses: bahmutov/npm-install@v1
39+
- name: SPA 404 fallback
40+
run: cp -f dist/index.html dist/404.html
2241

23-
- name: Build project
24-
run: npm run build
42+
- name: Configure Pages
43+
uses: actions/configure-pages@v5
2544

26-
- name: Upload production-ready build files
27-
uses: actions/upload-artifact@v4
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
2847
with:
29-
name: production-files
3048
path: ./dist
3149

3250
deploy:
33-
name: Deploy
3451
needs: build
3552
runs-on: ubuntu-latest
36-
if: github.ref == 'refs/heads/main'
37-
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
3856
steps:
39-
- name: Download artifact
40-
uses: actions/download-artifact@v4
41-
with:
42-
name: production-files
43-
path: ./dist
44-
45-
- name: Deploy to GitHub Pages
46-
uses: peaceiris/actions-gh-pages@v4
47-
with:
48-
github_token: ${{ secrets.GITHUB_TOKEN }}
49-
publish_dir: ./dist
57+
- id: deployment
58+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)