更新 .gitea/workflows/action.yaml
This commit is contained in:
parent
9804f9edfd
commit
fa7fe077e2
@ -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:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4 # 注意:在Gitea中,可能使用gitea的actions/checkout,但通常兼容
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20' # 使用最新的 LTS 版本
|
node-version: '20'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci # 使用锁定文件安装依赖
|
run: npm ci
|
||||||
|
|
||||||
- name: Build project
|
- name: Build
|
||||||
run: npm run build # 执行构建命令
|
run: npm run build
|
||||||
|
|
||||||
|
# 将构建产物打包成tar.gz
|
||||||
- name: Archive build output
|
- name: Archive build output
|
||||||
|
run: tar -zcvf dist.tar.gz dist
|
||||||
|
|
||||||
|
# 上传Artifact
|
||||||
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist-artifact
|
name: dist-artifact
|
||||||
path: dist # Vue 项目默认构建输出目录
|
path: dist.tar.gz
|
||||||
retention-days: 7 # 产物保留天数
|
retention-days: 7 retention-days: 7 # 产物保留天数
|
Loading…
x
Reference in New Issue
Block a user