Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 38 additions & 16 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ 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:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository #在 GitHub Actions 的虚拟机上,把仓库里的代码拉下来
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
Expand All @@ -26,23 +29,39 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
- name: Upload common jar
uses: actions/upload-artifact@v4
with:
name: my-build
path: '**/build/libs/*.jar'
name: Common
path: Common/build/libs/*.jar

- name: Upload common api jar
uses: actions/upload-artifact@v4
with:
name: CommonApi
path: CommonApi/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 上。
uses: actions/download-artifact@v3
# 下载 Common JAR
- name: Download Common artifact
uses: actions/download-artifact@v4
with:
name: Common
path: ./build-artifacts/Common

# 下载 CommonApi JAR
- name: Download CommonApi artifact
uses: actions/download-artifact@v4
with:
name: my-build
path: ./build-artifacts
name: CommonApi
path: ./build-artifacts/CommonApi

- name: Create GitHub Release # 在 GitHub 上创建一个新的 Release(版本发布)
# 创建 Release
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -53,9 +72,12 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifact to Release # 上传构建产物到 Release
uses: softprops/action-gh-release@v1
with:
files: ./build-artifacts/**/*.jar
# 上传各子项目 JAR 到 Release
- name: Upload jars to Release separately
run: |
for file in ./build-artifacts/**/*.jar; do
echo "Uploading $file"
gh release upload "${GITHUB_REF_NAME}" "$file" --repo "${GITHUB_REPOSITORY}" --clobber
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Sun Sep 22 17:25:46 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
251 changes: 251 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading