Skip to content

Bump version (forgor) #278

Bump version (forgor)

Bump version (forgor) #278

Workflow file for this run

name: build
on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch: # Allow manual triggering from GitHub UI
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25-ea'
- name: Cache Gradle and RFG
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/jdks
key: gradle-${{ runner.os }}-rfg-1_12_2-${{ hashFiles('**/*.gradle*', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-rfg-1_12_2-
- name: Make gradlew executable
run: chmod +x gradlew
- name: Build
run: |
./gradlew --version
./gradlew setupDecompWorkspace --info
./gradlew build --info
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jars
path: build/libs/*.jar
- name: Publish GitHub Release (tags only)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF##*/}"
# Get version and release type from Gradle
VERSION=$(./gradlew -q printVersion)
FULL_VERSION=$(./gradlew -q printFullVersion)
RELEASE_TYPE=$(./gradlew -q printReleaseType)
# Get changelog from Gradle
NOTES_FILE="/tmp/release_notes.md"
./gradlew -q printChangelog > "$NOTES_FILE"
echo "Version: $VERSION, Release Type: $RELEASE_TYPE" >&2
echo "Generated release notes:" >&2
sed 's/^/ /' "$NOTES_FILE" >&2
# TODO: get "C.E.L.L.S" from gradle
gh release create "$TAG" build/libs/*.jar \
--title "$FULL_VERSION" \
--notes-file "$NOTES_FILE" \
$(if [[ "$RELEASE_TYPE" != "release" ]]; then echo "--prerelease"; fi)
- name: Publish to CurseForge (tags only)
if: ${{ env.CURSEFORGE_TOKEN != '' && startsWith(github.ref, 'refs/tags/') }}
env:
CURSEFORGE_TOKEN: ${{ env.CURSEFORGE_TOKEN }}
run: |
# Get release type from Gradle
RELEASE_TYPE=$(./gradlew -q printReleaseType)
# Gradle handles changelog and display name from mod_version
./gradlew curseforge --no-daemon \
-Ppublish_to_curseforge=true \
-Ppublish_with_changelog=true \
-Prelease_type="$RELEASE_TYPE"