更新 .gitea/workflows/action.yaml

This commit is contained in:
罗澜大帅哥 2025-06-30 22:26:44 +08:00
parent 9804f9edfd
commit fa7fe077e2

View File

@ -1,32 +1,33 @@
name: Build Vue Project name: Build Vue Project
on: on: [push]
push:
branches: [ main, master ] # 在推送到主分支时触发
workflow_dispatch: # 允许手动触发工作流
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4 # 注意在Gitea中可能使用gitea的actions/checkout但通常兼容
steps: - name: Set up Node.js
- name: Checkout code uses: actions/setup-node@v3
uses: actions/checkout@v4 with:
node-version: '20'
- name: Setup Node.js - name: Install dependencies
uses: actions/setup-node@v3 run: npm ci
with:
node-version: '20' # 使用最新的 LTS 版本
- name: Install dependencies - name: Build
run: npm ci # 使用锁定文件安装依赖 run: npm run build
- name: Build project # 将构建产物打包成tar.gz
run: npm run build # 执行构建命令 - name: Archive build output
run: tar -zcvf dist.tar.gz dist
- name: Archive build output # 上传Artifact
uses: actions/upload-artifact@v3 - name: Upload artifact
with: uses: actions/upload-artifact@v3
name: dist-artifact with:
path: dist # Vue 项目默认构建输出目录 name: dist-artifact
retention-days: 7 # 产物保留天数 path: dist.tar.gz
retention-days: 7 retention-days: 7 # 产物保留天数