From e654ff48020561fd363addeb0b044f992d606344 Mon Sep 17 00:00:00 2001 From: Alpha Date: Sat, 30 Dec 2023 19:00:48 +0900 Subject: [PATCH] Update build.yml (#62) Signed-off-by: Alpha --- .github/workflows/build.yml | 61 +++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18882c4e7..88bf77ff1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,21 +16,22 @@ jobs: strategy: matrix: base_jdk: [17] - graal: [latest] os: [ubuntu-22.04] if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')" runs-on: ${{ matrix.os }} steps: - - name: Checkout action - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Checkout pages - uses: actions/checkout@v3 + - name: Checkout javadocs + uses: actions/checkout@v4 + if: github.ref_name == env.MAIN_BRANCH with: + repository: PlazmaMC/Javadocs path: javadoc - ref: gh-pages - token: ${{ secrets.GH_PAT }} + ref: main + token: ${{ secrets.GITHUB_TOKEN }} - name: Validate Gradle Wrapper uses: gradle/wrapper-validation-action@v1 @@ -38,9 +39,9 @@ jobs: - name: Set up GraalVM ${{ matrix.base_jdk }} uses: graalvm/setup-graalvm@v1 with: - github-token: ${{ secrets.GH_PAT }} + github-token: ${{ secrets.GITHUB_TOKEN }} java-version: ${{ matrix.base_jdk }} - version: ${{ matrix.graal }} + version: latest cache: 'gradle' - name: Configure Git @@ -71,11 +72,11 @@ jobs: if: github.ref_name == env.MAIN_BRANCH run: | export GITHUB_USERNAME=${{ env.ORG_NAME }} - export GITHUB_TOKEN=${{ secrets.GH_PAT }} + export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} ./gradlew publish --stacktrace - name: Upload Artifacts - if: env.DEBUG == 'true' || !startsWith(github.ref_name, 'ver/') + if: "!startsWith(github.ref_name, 'ver/')" uses: actions/upload-artifact@v3 with: name: Artifacts @@ -84,24 +85,38 @@ jobs: Plazma-API/build/docs/javadoc - name: Get Release Number - run: echo "RELEASE=$(git ls-remote --tags origin | grep "release" | wc -l)" >> $GITHUB_ENV + if: startsWith(github.ref_name, 'ver/') + run: echo "RELEASE=$(git ls-remote --tags origin | grep "build/${{ env.MC_VERSION }}" | wc -l)" >> $GITHUB_ENV - name: Release Artifacts if: startsWith(github.ref_name, 'ver/') - uses: marvinpinto/action-automatic-releases@latest + uses: softprops/action-gh-release@v0.1.15 with: - title: "Release #${{ env.RELEASE }}" - automatic_release_tag: release-${{ env.RELEASE }} - repo_token: "${{ secrets.GH_PAT }}" + name: "Build #${{ env.RELEASE }} for ${{ env.MC_VERSION }}" + tag_name: build/${{ env.MC_VERSION }}/${{ env.RELEASE }} + target_commitish: ${{ github.ref_name }} + generate_release_notes: true + fail_on_unmatched_files: true files: build/libs/*.jar - prerelease: false - - name: Release Artifacts (Latest) + - name: Release Artifacts (Latest/Stable) if: startsWith(github.ref_name, 'ver/') - uses: marvinpinto/action-automatic-releases@latest + uses: softprops/action-gh-release@v0.1.15 + with: + name: "Build #${{ env.RELEASE }} for ${{ env.MC_VERSION }}" + tag_name: build/${{ env.MC_VERSION }}/latest + target_commitish: ${{ github.ref_name }} + generate_release_notes: true + fail_on_unmatched_files: true + files: build/libs/*.jar + + - name: Release Artifacts (Latest/Development) + if: startsWith(github.ref_name, 'dev/') + uses: softprops/action-gh-release@v0.1.15 with: - title: "Release #${{ env.RELEASE }}" - automatic_release_tag: latest-${{ env.MC_VERSION }} - repo_token: "${{ secrets.GH_PAT }}" + name: "Development Build for ${{ env.MC_VERSION }}" + tag_name: build/${{ env.MC_VERSION }}/latest + target_commitish: ${{ github.ref_name }} + generate_release_notes: true + fail_on_unmatched_files: true files: build/libs/*.jar - prerelease: false