-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,38 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: deploy github pages | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
branches: | ||
- main # 监听 main 分支的推送 | ||
|
||
jobs: | ||
build: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: install nodejs | ||
uses: actions/[email protected] | ||
with: | ||
node-version: "23.x" | ||
- name: install deps | ||
run: npm install | ||
- name: build | ||
run: npm run build | ||
- name: Deploy GitHub Pages site | ||
uses: actions/[email protected] | ||
# Step 1: Checkout the code from the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# Step 2: Set up Node.js environment | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '23' # 你可以根据需求设置 Node.js 版本 | ||
|
||
# Step 3: Install dependencies | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Step 4: Build the project | ||
- name: Build the project | ||
run: npm run build | ||
|
||
# Step 5: Deploy to GitHub Pages | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages # 部署到 gh-pages 分支 | ||
folder: dist # 要部署的文件夹,这里是 Vue 项目的 dist 目录 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub 提供的自动身份验证令牌 |