diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..9b3c047e --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,24 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' + +categories: + - title: 'Features' + labels: + - 'enhancement' + - title: 'Bug Fixes' + labels: + - 'bug' + - title: 'Maintenance' + labels: + - 'dependencies' + - 'documentation' + +change-template: '- $TITLE (#$NUMBER) @$AUTHOR' +change-title-escapes: '\<*_&' + +template: | + ## What's Changed + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 414a9575..912c8edd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout PR merge commit if: github.event_name == 'pull_request' - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: refs/pull/${{ github.event.pull_request.number }}/merge fetch-depth: 0 @@ -24,7 +24,7 @@ jobs: - name: Checkout main on push if: github.event_name == 'push' - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true @@ -36,12 +36,12 @@ jobs: distribution: 'temurin' - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v6 - name: Build with Gradle Wrapper run: ./gradlew clean build - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: Staging-Build path: build/libs diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml new file mode 100644 index 00000000..1bffe0b1 --- /dev/null +++ b/.github/workflows/release-draft.yml @@ -0,0 +1,41 @@ +name: Update Release Draft + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: read + +jobs: + update-draft: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + + - name: Compute next release version + id: version + run: | + NEXT="$(./gradlew -q printNextReleaseVersion)" + echo "next=${NEXT}" >> "$GITHUB_OUTPUT" + + - name: Update release draft + uses: release-drafter/release-drafter@v7 + with: + version: ${{ steps.version.outputs.next }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..77990d16 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Attach Release Artifacts + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + fetch-tags: true + ref: ${{ github.event.release.tag_name }} + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + + - name: Build with Gradle Wrapper + run: ./gradlew clean build + + - name: Attach shaded JAR to release + uses: softprops/action-gh-release@v3 + with: + files: build/libs/*.jar + fail_on_unmatched_files: true diff --git a/README.md b/README.md index 4f508905..f099d7a1 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,23 @@ dedicated to the Plot-System itself.
* Submitting a fix * Proposing new features +### Commit Naming Conventions + +To keep our commit history clean and readable, please follow a naming convention for your commits by using one of the +following prefixes (based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary)): + +* `feat:` - A new feature +* `fix:` - A bug fix +* `docs:` - Documentation only changes +* `style:` - Changes that do not affect the meaning of the code (white-space, formatting, etc.) +* `refactor:` - A code change that neither fixes a bug nor adds a feature +* `perf:` - A code change that improves performance +* `test:` - Adding missing tests or correcting existing tests +* `chore:` - Changes to the build process or auxiliary tools and libraries + +If no recognized prefix is provided, the maintainers may ask you to revise your commit message, or they may squash and +rename the commit with an appropriate prefix upon merging. + # License Distributed under the MIT License. See `LICENSE` for more information. diff --git a/build.gradle.kts b/build.gradle.kts index 8fb3af4c..116d409a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - alias(libs.plugins.git.version) + alias(libs.plugins.git.semver) alias(libs.plugins.shadow) } @@ -61,11 +61,8 @@ dependencies { compileOnly(libs.io.papermc.paper.paper.api) } -val versionDetails: groovy.lang.Closure by extra -val details = versionDetails() - group = "com.alpsbte" -version = "5.0.3" + "-" + details.gitHash + "-SNAPSHOT" +version = semver.semVersion description = "An easy to use building system for the BuildTheEarth project." java.sourceCompatibility = JavaVersion.VERSION_21 @@ -92,6 +89,13 @@ tasks.jar { enabled = false // Disable the default jar task since we are using shadowJar } +tasks.register("printNextReleaseVersion") { + val nextRelease = semver.version.toString().removeSuffix("-SNAPSHOT") + doLast { + println(nextRelease) + } +} + tasks.processResources { // work around IDEA-296490 duplicatesStrategy = DuplicatesStrategy.INCLUDE diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 29c848f9..e66ee32f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -20,7 +20,7 @@ org-mariadb-jdbc-mariadb-java-client = "3.5.7" # https://central.sonatype.com/a com-intellectualsites-bom-bom-newest = "1.55" # Ref: https://github.com/IntellectualSites/bom # Plugins shadow = "9.3.1" # https://github.com/GradleUp/shadow/releases -git-version = "5.0.0" # https://github.com/palantir/gradle-git-version/releases +git-semver = "0.19.0" # https://github.com/jmongard/Git.SemVersioning.Gradle/releases [libraries] com-alpsbte-alpslib-alpslib-hologram = { module = "com.alpsbte.alpslib:alpslib-hologram", version.ref = "com-alpsbte-alpslib-alpslib-hologram" } @@ -41,5 +41,5 @@ org-mariadb-jdbc-mariadb-java-client = { module = "org.mariadb.jdbc:mariadb-java com-intellectualsites-bom-bom-newest = { module = "com.intellectualsites.bom:bom-newest", version.ref = "com-intellectualsites-bom-bom-newest" } [plugins] -git-version = { id = "com.palantir.git-version", version.ref = "git-version" } +git-semver = { id = "com.github.jmongard.git-semver-plugin", version.ref = "git-semver" } shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }