From 3fb9f9b7cfc1b78e182c4b0b49022c5514db45ee Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Sun, 21 Sep 2025 15:30:42 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E6=9E=84=E5=BB=BA=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=20v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-release.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 01f8d99..d9a69b2 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -2,8 +2,11 @@ name: Build and Release on: push: + branches: + - "rebuild-develop" # develop分支 + - "rebuild-release" # release 分支 tags: - - 'build*' # 当推送以 build:开头的 tag 时触发,比如 buildXXXX + - 'build-*' # 打 tag 时跑 build + release workflow_dispatch: # 允许手动触发 jobs: @@ -11,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository #在 GitHub Actions 的虚拟机上,把仓库里的代码拉下来 + - name: Checkout repository uses: actions/checkout@v3 - name: Set up JDK 17 @@ -33,16 +36,17 @@ jobs: path: '**/build/libs/*.jar' release: - needs: build # 这个 job 依赖于上一个 job build 完成。 + needs: build runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/build-') # 只有打 tag 才执行 release steps: - - name: Download build artifact # 把上一个 job 上传的构建产物下载到当前 job 的 runner 上。 + - name: Download build artifact uses: actions/download-artifact@v3 with: name: my-build path: ./build-artifacts - - name: Create GitHub Release # 在 GitHub 上创建一个新的 Release(版本发布) + - name: Create GitHub Release id: create_release uses: softprops/action-gh-release@v1 with: @@ -53,7 +57,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload artifact to Release # 上传构建产物到 Release + - name: Upload artifact to Release uses: softprops/action-gh-release@v1 with: files: ./build-artifacts/**/*.jar