The commit step failed when the input version matched the existing version in build.gradle.kts, causing `git commit` to exit 1 on an empty diff. Co-Authored-By: Claude Opus 4.6 <[email protected]>
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Release version (e.g. 1.1.0)"
|
|
required: true
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
|
|
- uses: gradle/actions/setup-gradle@v5
|
|
|
|
- name: Set version
|
|
run: sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" build.gradle.kts
|
|
|
|
- run: ./gradlew build
|
|
|
|
- name: Create GitHub Release
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
gh release create "v${{ inputs.version }}" \
|
|
--title "v${{ inputs.version }}" \
|
|
--generate-notes \
|
|
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
|
|
}
|