diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml new file mode 100644 index 00000000..8164402e --- /dev/null +++ b/.github/workflows/maven-build.yml @@ -0,0 +1,44 @@ +name: ZonePractice Build + +on: + push: + branches: [ "master", "main" ] + pull_request: + branches: [ "master", "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + lfs: true + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Install Local Dependencies + run: | + mvn install:install-file \ + -Dfile=libs/PaperSpigot-1.8.8-R0.1-SNAPSHOT.jar \ + -DgroupId=org.github.paperspigot \ + -DartifactId=paperspigot-api \ + -Dversion=1.8.8-R0.1-SNAPSHOT \ + -Dpackaging=jar \ + -DgeneratePom=true + + - name: Build with Maven + run: mvn -B clean install --file pom.xml + + - name: Upload Build Artifact + uses: actions/upload-artifact@v4 + with: + name: ZonePractice-Plugin + path: distribution/target/*.jar + retention-days: 5 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..1d9d82f1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,73 @@ +name: Auto Release on Version Change + +on: + push: + branches: [ "master", "main" ] + paths: [ "pom.xml" ] + +jobs: + check-and-release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + lfs: true + fetch-depth: 2 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Install Local Dependencies + run: | + mvn install:install-file \ + -Dfile=libs/PaperSpigot-1.8.8-R0.1-SNAPSHOT.jar \ + -DgroupId=org.github.paperspigot \ + -DartifactId=paperspigot-api \ + -Dversion=1.8.8-R0.1-SNAPSHOT \ + -Dpackaging=jar \ + -DgeneratePom=true + + - name: Check for Version Change + id: check_version + run: | + # Get current version (-N = non-recursive, only main pom) + NEW_VERSION=$(mvn -N help:evaluate -Dexpression=project.version -q -DforceStdout) + + # Get previous version (save previous pom to a temp file) + git show HEAD^:pom.xml > pom_old.xml + OLD_VERSION=$(mvn -N -f pom_old.xml help:evaluate -Dexpression=project.version -q -DforceStdout) + rm pom_old.xml + + echo "Previous version: $OLD_VERSION" + echo "Current version: $NEW_VERSION" + + # Compare versions + if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then + echo "changed=true" >> $GITHUB_OUTPUT + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "Version change detected! ($OLD_VERSION -> $NEW_VERSION)" + else + echo "changed=false" >> $GITHUB_OUTPUT + echo "Version number did not change. Skipping release." + fi + + - name: Build with Maven + if: steps.check_version.outputs.changed == 'true' + run: mvn -B clean install --file pom.xml + + - name: Create GitHub Release + if: steps.check_version.outputs.changed == 'true' + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ steps.check_version.outputs.version }} + name: ZonePractice v${{ steps.check_version.outputs.version }} + files: distribution/target/*.jar + generate_release_notes: true \ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml index 3e8f6f17..ed2ea47f 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ dev.nandi0813 practice-parent - 6.22-SNAPSHOT + 6.22.1-SNAPSHOT practice-core @@ -45,8 +45,7 @@ org.github.paperspigot paperspigot-api 1.8.8-R0.1-SNAPSHOT - system - ${basedir}/../libs/PaperSpigot-1.8.8-R0.1-SNAPSHOT.jar + provided diff --git a/distribution/pom.xml b/distribution/pom.xml index ea075cbd..b9272baa 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -10,7 +10,7 @@ dev.nandi0813 practice-parent - 6.22-SNAPSHOT + 6.22.1-SNAPSHOT @@ -23,9 +23,9 @@ clean install - ZonePractice Pro v6.22-SNAPSHOT + ZonePractice Pro v6.22.1-SNAPSHOT - + org.apache.maven.plugins maven-shade-plugin @@ -37,9 +37,6 @@ shade - false - ${project.build.finalName}.jar - false diff --git a/pom.xml b/pom.xml index 67206f02..ad9809c0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.nandi0813 practice-parent - 6.22-SNAPSHOT + 6.22.1-SNAPSHOT pom ZonePractice Pro @@ -93,7 +93,7 @@ net.wesjd anvilgui - 1.10.10-SNAPSHOT + 1.10.11-SNAPSHOT diff --git a/spigot_1_8_8/pom.xml b/spigot_1_8_8/pom.xml index c2fa1dca..6d3f2a41 100644 --- a/spigot_1_8_8/pom.xml +++ b/spigot_1_8_8/pom.xml @@ -7,7 +7,7 @@ dev.nandi0813 practice-parent - 6.22-SNAPSHOT + 6.22.1-SNAPSHOT practice-spigot_1_8_8 @@ -18,8 +18,7 @@ org.github.paperspigot paperspigot-api 1.8.8-R0.1-SNAPSHOT - system - ${basedir}/../libs/PaperSpigot-1.8.8-R0.1-SNAPSHOT.jar + provided diff --git a/spigot_modern/pom.xml b/spigot_modern/pom.xml index 4044e89b..8549102f 100644 --- a/spigot_modern/pom.xml +++ b/spigot_modern/pom.xml @@ -7,7 +7,7 @@ dev.nandi0813 practice-parent - 6.22-SNAPSHOT + 6.22.1-SNAPSHOT practice-spigot_modern