From 8434da0e025dcaeb18f395b0fec8bb18e41d9360 Mon Sep 17 00:00:00 2001 From: JetsadaWijit Date: Sat, 24 Jan 2026 02:14:25 +0700 Subject: [PATCH 1/4] chore: Increment project iteration to 2 Updated project iteration number from 1 to 2. --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b60224e..95e1126 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,10 @@ git-org-repository=mcextension # --- Artifact Identity --- project-version=2026.0.2 -project-iteration=1 +project-iteration=2 project-group=io.github.mcengine project-artifact-id=mcextension project-artifact-name=MCExtension project-artifact-description=This project is a library designed to allow Minecraft plugins to load their own extensions. project-artifact-url=https://mcengine.github.io/mcextension-website + From 6516c8246abcaf1498a830f2612dcc70a7a8b35a Mon Sep 17 00:00:00 2001 From: JetsadaWijit Date: Sat, 24 Jan 2026 02:15:44 +0700 Subject: [PATCH 2/4] ci: skip publishing steps when project-iteration is 0 Added a step to check the project iteration from gradle.properties and updated conditions for publishing builds based on iteration. --- .github/workflows/build.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81f2748..4706833 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,13 @@ jobs: chmod +x gradlew sed -i 's/\r$//' gradlew + # Added step to check project-iteration from gradle.properties + - name: Check Iteration + id: check_iteration + run: | + ITERATION=$(grep 'project-iteration=' gradle.properties | cut -d'=' -f2) + echo "iteration=$ITERATION" >> $GITHUB_OUTPUT + # 4a. Build (Test Only) # Run this ONLY for Pull Requests. - name: Build (Test Only) @@ -39,8 +46,9 @@ jobs: # 4b. Build & Publish (DEV) # Run this for 'push to master' (creates -DEV builds) + # Logic: Run if (push OR PR) AND NOT a tag AND iteration != 0 - name: Publish Dev Build - if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && !startsWith(github.ref, 'refs/tags/') }} + if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && !startsWith(github.ref, 'refs/tags/') && steps.check_iteration.outputs.iteration != '0' }} run: ./gradlew clean build publish env: BUILD_NUMBER: ${{ github.run_number }} @@ -48,9 +56,9 @@ jobs: USER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 4c. Build & Publish (RELEASE) - # Run this ONLY when a tag (v*) is pushed. + # Run this ONLY when a tag (v*) is pushed AND iteration != 0 - name: Publish Release - if: ${{ startsWith(github.ref, 'refs/tags/') }} + if: ${{ startsWith(github.ref, 'refs/tags/') && steps.check_iteration.outputs.iteration != '0' }} run: ./gradlew clean build publish env: # We pass the tag name (e.g., v2026.0.0) to Gradle From 6e2a59c847e49c0a104e828681093c0636d40f50 Mon Sep 17 00:00:00 2001 From: JetsadaWijit Date: Sat, 24 Jan 2026 02:17:03 +0700 Subject: [PATCH 3/4] ci: reset iteration to 0 in monthly update to prevent auto-publish --- .github/workflows/build_monthly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_monthly.yml b/.github/workflows/build_monthly.yml index 2698927..b04b812 100644 --- a/.github/workflows/build_monthly.yml +++ b/.github/workflows/build_monthly.yml @@ -57,8 +57,8 @@ jobs: # 1. Update Version (e.g., 2026.0.2) sed -i "s/^project-version=.*/project-version=$NEW_VERSION/" gradle.properties - # 2. Reset Iteration to 1 (So next dev build starts at 1) - sed -i "s/^project-iteration=.*/project-iteration=1/" gradle.properties + # 2. Reset Iteration to 0 (So next dev build starts at 0) + sed -i "s/^project-iteration=.*/project-iteration=0/" gradle.properties # Verify grep "project-version" gradle.properties From 96a93cf32575845cbb3972ef9c896fc9ef72e4fd Mon Sep 17 00:00:00 2001 From: JetsadaWijit Date: Sat, 24 Jan 2026 02:52:50 +0700 Subject: [PATCH 4/4] ci: automate tagging and sequential release build --- .github/workflows/build.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4706833..562d834 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,12 +11,14 @@ jobs: build: runs-on: ubuntu-latest permissions: - contents: read + contents: write packages: write steps: - name: Checkout Code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 21 uses: actions/setup-java@v4 @@ -34,7 +36,9 @@ jobs: id: check_iteration run: | ITERATION=$(grep 'project-iteration=' gradle.properties | cut -d'=' -f2) + VERSION=$(grep 'project-version=' gradle.properties | cut -d'=' -f2) echo "iteration=$ITERATION" >> $GITHUB_OUTPUT + echo "version=$VERSION" >> $GITHUB_OUTPUT # 4a. Build (Test Only) # Run this ONLY for Pull Requests. @@ -48,6 +52,7 @@ jobs: # Run this for 'push to master' (creates -DEV builds) # Logic: Run if (push OR PR) AND NOT a tag AND iteration != 0 - name: Publish Dev Build + id: publish_dev if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && !startsWith(github.ref, 'refs/tags/') && steps.check_iteration.outputs.iteration != '0' }} run: ./gradlew clean build publish env: @@ -56,16 +61,29 @@ jobs: USER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 4c. Build & Publish (RELEASE) - # Run this ONLY when a tag (v*) is pushed AND iteration != 0 + # Run ONLY when code is pushed/merged to master AND iteration != 0 + # UPDATED: Added requirement for step 4b (publish_dev) to finish successfully. - name: Publish Release - if: ${{ startsWith(github.ref, 'refs/tags/') && steps.check_iteration.outputs.iteration != '0' }} + id: publish_release + if: ${{ steps.publish_dev.outcome == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.check_iteration.outputs.iteration != '0' }} run: ./gradlew clean build publish env: - # We pass the tag name (e.g., v2026.0.0) to Gradle - RELEASE_VERSION: ${{ github.ref_name }} + # We pass the branch name (master) to Gradle + RELEASE_VERSION: ${{ steps.check_iteration.outputs.version }} USER_GITHUB_NAME: ${{ github.actor }} USER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 4d. Auto Create Tag + # Automatically creates a git tag after successful 4c publish. + - name: Create Git Tag + if: ${{ steps.publish_release.outcome == 'success' }} + run: | + TAG_NAME="v${{ steps.check_iteration.outputs.version }}" + git tag $TAG_NAME + git push origin $TAG_NAME + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: