From 1a693822bc96cc62fbfd9759a018860f72245c41 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:06:39 -0400 Subject: [PATCH] [ci skip] Split publish api workflow --- .github/workflows/build-1214.yml | 9 ------ .github/workflows/build-pr.yml | 9 +++--- .github/workflows/publish-api.yml | 54 +++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/publish-api.yml diff --git a/.github/workflows/build-1214.yml b/.github/workflows/build-1214.yml index 24e62557..e19260f2 100644 --- a/.github/workflows/build-1214.yml +++ b/.github/workflows/build-1214.yml @@ -82,15 +82,6 @@ jobs: - name: Create MojmapPaperclipJar run: ./gradlew createMojmapPaperclipJar --stacktrace --parallel --no-daemon - - name: Publish API - continue-on-error: true - run: | - ./gradlew :leaf-api:publish - ./gradlew publishDevBundlePublicationToLeafRepository -PpublishDevBundle=true - env: - REPO_USER: ${{ secrets.REPO_USER }} - REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }} - - name: Rename Paperclip JARs run: | mv leaf-server/build/libs/leaf-paperclip-1.21.4-R0.1-SNAPSHOT-mojmap.jar ./leaf-1.21.4-${{ env.BUILD_NUMBER }}-mojmap.jar diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index cedfc8c4..fd66d8b9 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -14,12 +14,11 @@ jobs: - name: Checkout repository uses: actions/checkout@main - - name: Set up GraalVM JDK 21 - uses: graalvm/setup-graalvm@main + - name: Setup java + uses: useblacksmith/setup-java@v5 with: - java-version: 21 - github-token: "${{ secrets.GITHUB_TOKEN }}" - cache: gradle + distribution: 'temurin' + java-version: '21' - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/.github/workflows/publish-api.yml b/.github/workflows/publish-api.yml new file mode 100644 index 00000000..71bf488a --- /dev/null +++ b/.github/workflows/publish-api.yml @@ -0,0 +1,54 @@ +name: Publish API +on: + push: + branches: [ "ver/1.21.4" ] + +jobs: + build: + runs-on: ubuntu-latest + env: + BUILD_NUMBER: ${{ github.run_number }} + GRADLE_MEMORY: "-Xmx4g -XX:MaxMetaspaceSize=2g" + steps: + - name: Checkout repository + uses: actions/checkout@main + with: + fetch-depth: 0 + + - name: Set up GraalVM JDK 21 + uses: graalvm/setup-graalvm@main + with: + java-version: 21 + github-token: "${{ secrets.GITHUB_TOKEN }}" + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Configure Git + run: | + git config --global user.email "no-reply@github.com" + git config --global user.name "Github Actions" + + - name: Apply patches + run: | + PARALLELISM=$(($(nproc) * 2)) + ./gradlew -Dorg.gradle.jvmargs="${{ env.GRADLE_MEMORY }}" \ + -Dleaf.patcher.parallelism=$PARALLELISM \ + -Dleaf.patcher.incremental=true \ + applyAllPatches \ + --stacktrace --parallel \ + --max-workers=$PARALLELISM \ + --build-cache \ + --no-daemon + + - name: Build + run: ./gradlew build -x test + + - name: Publish API + continue-on-error: true + run: | + ./gradlew :leaf-api:publish + ./gradlew publishDevBundlePublicationToLeafRepository -PpublishDevBundle=true + env: + REPO_USER: ${{ secrets.REPO_USER }} + REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}