-
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
1 parent
6fc1eeb
commit 1be69a2
Showing
1 changed file
with
62 additions
and
0 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 |
---|---|---|
@@ -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 |