Skip to content

Commit

Permalink
ci: add deploy github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Nov 22, 2024
1 parent 56cf7c2 commit fc77e93
Show file tree
Hide file tree
Showing 4 changed files with 3,199 additions and 14 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,57 @@
name: GitHub Pages

on:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Setup Node
uses: actions/setup-node@v2
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
node-version: "14.x"
run_install: true

- name: Install Dependencies
run: npm install
- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
cache: pnpm

- name: Build
run: npm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- name: ⏫ Upload artifact
uses: actions/upload-pages-artifact@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
force_orphan: true
path: ./dist

deploy:
needs: build
runs-on: ubuntu-latest

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: 🪤 Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ dist-ssr
# lock
yarn.lock
package-lock.json
pnpm-lock.yaml

*.log
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "element-plus-vite-starter",
"private": true,
"version": "0.1.0",
"packageManager": "[email protected]",
"scripts": {
"dev": "vite",
"build": "vite build",
Expand Down
Loading

0 comments on commit fc77e93

Please sign in to comment.