Skip to content

Commit

Permalink
Create vue-gh-pages.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim-Lin-4549 authored Dec 7, 2024
1 parent 6fc1eeb commit 1be69a2
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/vue-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Vue Deploy

on:
# 当推送到默认分支时触发
push:
branches: ["main"]

# 允许从 GitHub Actions 页面手动触发
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# 构建任务
build:
runs-on: ubuntu-latest
steps:
# 检出代码
- name: Checkout Repository
uses: actions/checkout@v4

# 设置 Node.js 环境
- name: Setup Node.js
uses: actions/setup-node@v4

# 安装 pnpm
- name: Install pnpm
run: npm install -g pnpm

# 安装依赖
- name: Install Dependencies
run: pnpm install

# 构建 Vue.js 项目
- name: Build Vue.js Project
run: pnpm build

# 上传构建产物
- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./dist # Vue.js 默认的构建输出目录为 dist

# 部署任务
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
# 部署到 GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 1be69a2

Please sign in to comment.