From e6ce7c526f208a0813f2c8199316dc1608830445 Mon Sep 17 00:00:00 2001 From: UnknownMp Date: Fri, 2 May 2025 16:41:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=95=B4=E7=9A=84CI=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 64f61e6..56afc3b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,9 +2,8 @@ name: Node.js CI on: push: - branches: - - main - pull_request: + tags: + - 'v*' # 匹配所有 tag(也可改为 v* 等更具体的匹配) jobs: build-and-test: @@ -17,7 +16,7 @@ jobs: - name: 设置 Node.js uses: actions/setup-node@v3 with: - node-version: '22' # 可改为 16/20 等版本 + node-version: '22' - name: 缓存 npm 模块 uses: actions/cache@v4 @@ -32,7 +31,6 @@ jobs: - name: 构建项目(可选) run: npm run build - if: success() - name: 打包构建产物 run: | @@ -51,7 +49,11 @@ jobs: echo " StrictHostKeyChecking no" >> ~/.ssh/config echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config - - name: 测试 SSH 连接 - run: | - scp output.zip default@10.0.0.3:/tmp/1.zip + - name: 获取 Tag 名称 + id: extract_tag + run: echo "tag=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT + + - name: 上传产物到远程服务器 + run: | + scp output.zip default@10.0.0.3:/srv/publish/ao3-mirror-ssr/${{ steps.extract_tag.outputs.tag }}.zip