Skip to content

Commit fc77e93

Browse files
committed
ci: add deploy github pages
1 parent 56cf7c2 commit fc77e93

File tree

4 files changed

+3199
-14
lines changed

4 files changed

+3199
-14
lines changed

.github/workflows/gh-pages.yml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,57 @@
11
name: GitHub Pages
2+
23
on:
34
push:
45
branches:
56
- main
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow one concurrent deployment
15+
concurrency:
16+
group: pages
17+
cancel-in-progress: true
18+
619
jobs:
7-
deploy:
20+
build:
821
runs-on: ubuntu-latest
922
steps:
1023
- uses: actions/checkout@v2
11-
with:
12-
submodules: true
1324

14-
- name: Setup Node
15-
uses: actions/setup-node@v2
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v2
1627
with:
17-
node-version: "14.x"
28+
run_install: true
1829

19-
- name: Install Dependencies
20-
run: npm install
30+
- name: Use Node.js LTS
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: lts/*
34+
registry-url: https://registry.npmjs.org/
35+
cache: pnpm
2136

2237
- name: Build
2338
run: npm run build
2439

25-
- name: Deploy
26-
uses: peaceiris/actions-gh-pages@v3
40+
- name: ⏫ Upload artifact
41+
uses: actions/upload-pages-artifact@v1
2742
with:
28-
github_token: ${{ secrets.GITHUB_TOKEN }}
29-
publish_dir: ./dist
30-
force_orphan: true
43+
path: ./dist
44+
45+
deploy:
46+
needs: build
47+
runs-on: ubuntu-latest
48+
49+
# Deploy to the github-pages environment
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
54+
steps:
55+
- name: 🪤 Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v1

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ dist-ssr
99
# lock
1010
yarn.lock
1111
package-lock.json
12-
pnpm-lock.yaml
1312

1413
*.log

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "element-plus-vite-starter",
33
"private": true,
44
"version": "0.1.0",
5+
"packageManager": "[email protected]",
56
"scripts": {
67
"dev": "vite",
78
"build": "vite build",

0 commit comments

Comments
 (0)