From fa7fe077e216ebd8a927d9a95c44a1524a9abe91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=BE=9C=E5=A4=A7=E5=B8=85=E5=93=A5?= Date: Mon, 30 Jun 2025 22:26:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/action.ya?= =?UTF-8?q?ml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/action.yaml | 55 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/action.yaml b/.gitea/workflows/action.yaml index 38721cb..1583cb6 100644 --- a/.gitea/workflows/action.yaml +++ b/.gitea/workflows/action.yaml @@ -1,32 +1,33 @@ name: Build Vue Project -on: - push: - branches: [ main, master ] # 在推送到主分支时触发 - workflow_dispatch: # 允许手动触发工作流 +on: [push] - jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' # 使用最新的 LTS 版本 +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 # 注意:在Gitea中,可能使用gitea的actions/checkout,但通常兼容 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build - - name: Install dependencies - run: npm ci # 使用锁定文件安装依赖 + # 将构建产物打包成tar.gz + - name: Archive build output + run: tar -zcvf dist.tar.gz dist - - name: Build project - run: npm run build # 执行构建命令 - - - name: Archive build output - uses: actions/upload-artifact@v3 - with: - name: dist-artifact - path: dist # Vue 项目默认构建输出目录 - retention-days: 7 # 产物保留天数 \ No newline at end of file + # 上传Artifact + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist-artifact + path: dist.tar.gz + retention-days: 7 retention-days: 7 # 产物保留天数 \ No newline at end of file