Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fb0sh authored Nov 10, 2024
1 parent 24d7cfc commit c5b5f9a
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions .github/workflows/ci.yml
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 提供的自动身份验证令牌

0 comments on commit c5b5f9a

Please sign in to comment.