From 9834f9a675d3e73888887c3e889e54c4400b710c Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Fri, 27 Feb 2026 19:13:23 +0100 Subject: [PATCH] feat: revamp release workflow with changelog, snapshot bump, and no v prefix - Split version setting into reusable set-version.yml workflow - Release tags/titles no longer use "v" prefix - Added after-version input to bump back to SNAPSHOT after release - Generate categorized changelog from conventional commits using mikepenz/release-changelog-builder-action Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release.yml | 77 ++++++++++++++++++++++++------- .github/workflows/set-version.yml | 30 ++++++++++++ 2 files changed, 91 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/set-version.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b5879e..561cccd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,15 +6,27 @@ on: version: description: "Release version (e.g. 1.1.0)" required: true + after-version: + description: "Next snapshot version (e.g. 1.2.0-SNAPSHOT)" + required: true permissions: contents: write jobs: - release: + set-release-version: + uses: ./.github/workflows/set-version.yml + with: + version: ${{ inputs.version }} + + build: + needs: set-release-version runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + with: + ref: ${{ github.ref }} + fetch-depth: 0 - uses: actions/setup-java@v5 with: @@ -23,29 +35,62 @@ jobs: - uses: gradle/actions/setup-gradle@v5 - - name: Set version - run: sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" build.gradle.kts - - run: ./gradlew build + - name: Generate changelog + id: changelog + uses: mikepenz/release-changelog-builder-action@v6 + with: + commitMode: true + configurationJson: | + { + "categories": [ + { "title": "## Features", "labels": ["feat", "feature"] }, + { "title": "## Fixes", "labels": ["fix", "bug"] }, + { "title": "## Performance", "labels": ["perf"] }, + { "title": "## Refactor", "labels": ["refactor"] }, + { "title": "## Documentation", "labels": ["docs"] }, + { "title": "## Build", "labels": ["build", "chore", "ci"] }, + { "title": "## Other", "labels": [] } + ], + "label_extractor": [ + { + "pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)", + "on_property": "title", + "method": "match", + "target": "$1" + } + ], + "template": "#{{CHANGELOG}}", + "pr_template": "- [`#{{SHORT_MERGE_SHA}}`](https://github.com/#{{OWNER}}/#{{REPO}}/commit/#{{MERGE_SHA}}) #{{TITLE}}", + "custom_placeholders": [ + { + "name": "SHORT_MERGE_SHA", + "source": "MERGE_SHA", + "transformer": { + "pattern": "^([0-9a-f]{7})[0-9a-f]*$", + "target": "$1" + } + } + ] + } + env: + GITHUB_TOKEN: ${{ github.token }} + - name: Create GitHub Release env: GH_TOKEN: ${{ github.token }} run: | - gh release create "v${{ inputs.version }}" \ - --title "v${{ inputs.version }}" \ - --generate-notes \ + gh release create "${{ inputs.version }}" \ + --title "${{ inputs.version }}" \ + --notes "${{ steps.changelog.outputs.changelog }}" \ mc-1.21.8/build/libs/anarchymod-mc-1.21.8-${{ inputs.version }}.jar \ mc-1.21.9/build/libs/anarchymod-mc-1.21.9-${{ inputs.version }}.jar \ mc-1.21.10/build/libs/anarchymod-mc-1.21.10-${{ inputs.version }}.jar \ mc-1.21.11/build/libs/anarchymod-mc-1.21.11-${{ inputs.version }}.jar - - name: Commit version bump - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add build.gradle.kts - git diff --cached --quiet && echo "No version change to commit" || { - git commit -m "chore: bump version to ${{ inputs.version }}" - git push - } + set-after-version: + needs: build + uses: ./.github/workflows/set-version.yml + with: + version: ${{ inputs.after-version }} diff --git a/.github/workflows/set-version.yml b/.github/workflows/set-version.yml new file mode 100644 index 0000000..092f338 --- /dev/null +++ b/.github/workflows/set-version.yml @@ -0,0 +1,30 @@ +name: Set Version + +on: + workflow_dispatch: + inputs: + version: + description: "Version to set (e.g. 1.1.0 or 1.2.0-SNAPSHOT)" + required: true + workflow_call: + inputs: + version: + description: "Version to set" + required: true + type: string + +permissions: + contents: write + +jobs: + set-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Set version + run: sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" build.gradle.kts + + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore(release): bump version to ${{ inputs.version }}"