Skip to content

release

release #39

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: release
on:
workflow_dispatch:
inputs:
RELEASE_TYPE:
description: 'Release Type'
required: true
default: 'alpha'
MOD_VERSION:
description: 'Mod Version'
required: true
default: '2.2.0'
env:
MINECRAFT_VERSION: 1.19.2
JAVA_VERSION: 17
jobs:
changelog:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}}"
release_name: "${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}}"
body: |
See CHANGELOG.md for history of changes
draft: false
prerelease: false
- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged v${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}} | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: "v${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}}"
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update changelog"
- run: echo "${{ steps.changelog.outputs.changes }}" >> CHANGES.md
- name: Upload Changelog
uses: actions/upload-artifact@v4
with:
name: "changes"
path: |
CHANGES.md
retention-days: 1
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check Environment Variables
run: env
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: "${{ env.JAVA_VERSION }}"
- name: Build with Gradle
run: "chmod +x gradlew && ./gradlew clean build"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "build"
path: |
fabric/build/libs/*.jar
forge/build/libs/*.jar
common/build/libs/*.jar
retention-days: 1
github:
needs: [build, changelog]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "build"
path: build/
- name: Release the new binaries
uses: mini-bomba/[email protected]
with:
token: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
tag: "latest"
name: "Latest Commit, that compiles"
files: |
build/fabric/build/libs/*.jar
build/forge/build/libs/*.jar
build/common/build/libs/*.jar
clear_attachments: true
modrinth:
needs: [build, changelog]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "build"
path: build/
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: "changes"
path: changes/
- name: Publish Fabric
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
modrinth-id: sXMCPogN
modrinth-token: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: |
fabric
quilt
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/fabric/build/libs/!(*-@(sources)).jar
build/fabric/build/libs/*-@(sources).jar
build/common/build/libs/!(*-@(sources)).jar
build/common/build/libs/*-@(sources).jar
- name: Publish Forge
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
modrinth-id: sXMCPogN
modrinth-token: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: forge
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/forge/build/libs/!(*-@(sources|slim)).jar
build/forge/build/libs/*-@(sources).jar
curseforge:
needs: [build, changelog]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "build"
path: build/
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: "changes"
path: changes/
- name: Publish Fabric
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
curseforge-id: 449768
curseforge-token: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: |
fabric
quilt
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/fabric/build/libs/!(*-@(sources)).jar
build/fabric/build/libs/*-@(sources).jar
build/common/build/libs/!(*-@(sources)).jar
build/common/build/libs/*-@(sources).jar
- name: Publish Forge
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
curseforge-id: 387580
curseforge-token: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: forge
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/forge/build/libs/!(*-@(sources|slim)).jar
build/forge/build/libs/*-@(sources).jar