From 2d5bfca62d593439a3891b7e7cc74777be3f9dff Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Wed, 9 Oct 2024 18:47:21 -0700 Subject: [PATCH] chore(ci): enable publishing vanilla jars for update branches Signed-off-by: Gabriel Harris-Rouquette --- .github/workflows/common-run-build.yaml | 38 ++++++++++++++++--------- .github/workflows/deploy.yaml | 25 ++++++++++++++-- 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/.github/workflows/common-run-build.yaml b/.github/workflows/common-run-build.yaml index 027975557b0..c3dbfe08a8d 100644 --- a/.github/workflows/common-run-build.yaml +++ b/.github/workflows/common-run-build.yaml @@ -11,15 +11,30 @@ jobs: # Only run on PRs if the source branch is on someone else's repo if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}" runs-on: ubuntu-22.04 + strategy: + matrix: + project: + - vanilla + - forge + - neoforge + include: + - project: vanilla + gradleProject: SpongeVanilla + - project: forge + gradleProject: SpongeForge + - project: neoforge + gradleProject: SpongeNeo steps: - name: setup id: setup uses: SpongePowered/.github/.github/actions/setup-java-env@master + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" with: runtime_version: 21 publishing_branch_regex: 'api-\d+' - name: setup / cache minecraft dependencies uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2 + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" with: path: | ${{ github.workspace}}/buildSrc/.gradle/ @@ -28,15 +43,18 @@ jobs: restore-keys: | ${{ runner.os }}-minecraft-${{ env.CACHE_REV }}- - name: setup / environment + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" run: | echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: build with Gradle - run: ./gradlew -Pprojects=vanilla,forge,neoforge,testplugins build --stacktrace + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" + run: ./gradlew -Pprojects=${{ matrix.project }},testplugins build --stacktrace env: CI_SYSTEM: Github Actions - name: Archive artifacts for build + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1 with: name: Sponge Jars @@ -46,22 +64,14 @@ jobs: ${{ github.workspace }}/vanilla/build/libs/*.jar ${{ github.workspace }}/forge/build/libs/*.jar ${{ github.workspace }}/neoforge/build/libs/*.jar - - name: SpongeVanilla Production Jar + - name: ${{ matrix.gradleProject }} Production Jar + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1 with: - name: SpongeVanilla Production Jar - path: "${{ github.workspace }}/vanilla/build/libs/*-universal.jar" - - name: SpongeForge Production Jar - uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1 - with: - name: SpongeForge Production Jar - path: "${{ github.workspace }}/forge/build/libs/*-universal.jar" - - name: SpongeNeo Production Jar - uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1 - with: - name: SpongeNeo Production Jar - path: "${{ github.workspace }}/neoforge/build/libs/*-universal.jar" + name: ${{ matrix.gradleProject }} Production Jar + path: "${{ github.workspace }}/${{ matrix.project }}/build/libs/*-universal.jar" - name: SpongeVanilla libraries + if: "matrix.project == 'vanilla'" uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1 with: name: SpongeVanilla installer libraries diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 1ddb706d534..82311bfe60c 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -5,7 +5,9 @@ name: Build and Deploy on: push: - branches: [ 'api-*' ] + branches: + - 'api-*' + - 'update/*' tags-ignore: [ '**' ] env: @@ -22,13 +24,30 @@ jobs: publish: needs: integrationTest runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + project: + - vanilla + - forge + - neoforge + include: + - project: vanilla + gradleProject: SpongeVanilla + - project: forge + gradleProject: SpongeForge + - project: neoforge + gradleProject: SpongeNeo steps: - name: setup + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" id: setup uses: SpongePowered/.github/.github/actions/setup-java-env@master with: runtime_version: 21 + publishing_branch_regex: '' - name: setup / minecraft cache + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2 with: path: | @@ -39,12 +58,14 @@ jobs: ${{ runner.os }}-minecraft-${{ env.CACHE_REV }}- # We don't need to run tests again, so we just publish - name: setup / workspace + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" run: | echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - name: Publish to Sponge Maven & GitHub Packages - run: ./gradlew -s -Pprojects=vanilla,forge,neoforge :publish :SpongeVanilla:publish :SpongeForge:publish :SpongeNeo:publish + if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'" + run: ./gradlew -s -Pprojects=vanilla,${{ matrix.project }} :${{ matrix.gradleProject }}:publish env: CI_SYSTEM: Github Actions GITHUB_USERNAME: "${{ github.actor }}"