diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 093830d..0252598 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -29,27 +29,38 @@ jobs: - name: Build with Gradle run: ./gradlew clean build - - name: Upload each jar separately - run: | - for file in $(find . -name "*.jar" -path "*/build/libs/*"); do - echo "Uploading $file" - artifact_name=$(basename "$file" .jar) - gh release upload "${GITHUB_REF_NAME}" "$file" --repo "${GITHUB_REPOSITORY}" --clobber - done - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload common jar + uses: actions/upload-artifact@v4 + with: + 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 runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/build-') # 只有打 tag 才执行 release steps: - - name: Download build artifact + # 下载 Common JAR + - name: Download Common artifact uses: actions/download-artifact@v4 with: - name: my-build - path: ./build-artifacts + name: Common + path: ./build-artifacts/Common + # 下载 CommonApi JAR + - name: Download CommonApi artifact + uses: actions/download-artifact@v4 + with: + name: CommonApi + path: ./build-artifacts/CommonApi + + # 创建 Release - name: Create GitHub Release id: create_release uses: softprops/action-gh-release@v1 @@ -61,6 +72,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 上传各子项目 JAR 到 Release - name: Upload jars to Release separately run: | for file in ./build-artifacts/**/*.jar; do