From af95933aa28c6149aadec4bcd05267d2b9c7772a Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Sun, 21 Sep 2025 15:06:39 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E6=B5=8B=E8=AF=95=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-release.yml | 61 +++++++++++++++++++++++++ .idea/gradle.xml | 1 + 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/build-and-release.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..02c7668 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,61 @@ +name: Build and Release + +on: + push: + tags: + - 'build:*' # 当推送以 build: 开头的 tag 时触发,比如 build: XXXX + workflow_dispatch: # 允许手动触发 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository #在 GitHub Actions 的虚拟机上,把仓库里的代码拉下来 + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Grant execute permission for Gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew clean build + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: my-build + path: '**/build/libs/*.jar' + + release: + needs: build # 这个 job 依赖于上一个 job build 完成。 + runs-on: ubuntu-latest + steps: + - name: Download build artifact # 把上一个 job 上传的构建产物下载到当前 job 的 runner 上。 + uses: actions/download-artifact@v3 + with: + name: my-build + path: ./build-artifacts + + - name: Create GitHub Release # 在 GitHub 上创建一个新的 Release(版本发布) + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref_name }} + name: Release ${{ github.ref_name }} + body: | + 自动发布所有子项目构建产物。 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifact to Release # 上传构建产物到 Release + uses: softprops/action-gh-release@v1 + with: + files: ./build-artifacts/**/*.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index fea13de..7ebcaff 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ +