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 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a6c4ad75b4
commit
9834f9a675
@@ -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 }}
|
||||
|
||||
@@ -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 }}"
|
||||
Reference in New Issue
Block a user