Build and Release v5.3.13 #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
run-name: ${{ format('Build and Release v{0}', github.event.inputs.version) }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version (without "v" prefix)' | |
required: true | |
type: string | |
jobs: | |
deploy: | |
name: Build and Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Gradle | |
uses: null2264/actions/gradle-setup@1cc44b9be27b8914ca577a0905288e99c67df067 | |
with: | |
java: 21 | |
- name: Setup CHANGELOG parser | |
uses: taiki-e/install-action@parse-changelog | |
- name: Get MC versions | |
id: get-mc-versions | |
run: | | |
echo "versions=$(ls versions | grep -e '.\.' | grep -v 'mapping-' | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
- name: Get changelog | |
id: changelog | |
shell: bash | |
run: | | |
# extended SemVer (major.minor.patch.hotfix) | |
VERSION_FORMAT='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?(-[0-9A-Za-z\.-]+)?(\+[0-9A-Za-z\.-]+)?$|^Unreleased$' | |
{ | |
echo "CHANGELOG<<END_OF_FILE" | |
parse-changelog CHANGELOG.md ${{ github.event.inputs.version == '' && 'Unreleased' || github.event.inputs.version }} --version-format $VERSION_FORMAT || parse-changelog CHANGELOG.md Unreleased --version-format $VERSION_FORMAT || echo "" | |
echo "" | |
echo "END_OF_FILE" | |
} >> "$GITHUB_OUTPUT" 2> /dev/null | |
- name: Build with Gradle | |
uses: null2264/actions/replaymod-preprocessor-compile@1cc44b9be27b8914ca577a0905288e99c67df067 | |
with: | |
versions: ${{ steps.get-mc-versions.outputs.versions }} | |
- name: Archive build results | |
run: tar -I zstd -cf build.tar.zst versions/*/build/libs | |
- name: Upload build folders | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: build.tar.zst | |
if-no-files-found: error | |
retention-days: 3 | |
- name: Deploy to CurseForge and Modrinth | |
run: ./gradlew publishMods --stacktrace --no-daemon --max-workers 1 | |
env: | |
CHANGELOG: ${{ steps.changelog.outputs.CHANGELOG }} | |
CURSEFORGE: ${{ secrets.CURSEFORGE }} | |
MODRINTH: ${{ secrets.MODRINTH }} | |
- name: Deploy to GitHub | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{github.event.inputs.version}} | |
name: v${{github.event.inputs.version}} | |
body: | | |
${{ steps.changelog.outputs.CHANGELOG }} | |
files: | | |
versions/*/build/libs/!(*-dev-shade|*-sources).jar |