bump version #2
Workflow file for this run
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 | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v1.20.1-forge-*.*.*' | |
env: | |
JAVA_DIST: 'zulu' | |
JAVA_VERSION: 17 | |
MOD_ID: 'kubejs_enderio' | |
MOD_NAME: 'KubeJS-EnderIO' | |
CURSEFORGE_ID: '910379' | |
MODRINTH_ID: 'BotkzaBk' | |
jobs: | |
checking: | |
name: Checking prerequisites | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Secrets | |
run: | | |
if [ -z "${{ secrets.MODRINTH_TOKEN }}" ]; then | |
echo "MODRINTH_TOKEN is not set" | |
exit 1 | |
fi | |
if [ -z "${{ secrets.CURSEFORGE_TOKEN }}" ]; then | |
echo "CURSEFORGE_TOKEN is not set" | |
exit 1 | |
fi | |
- name: Validate Modrinth Token | |
run: | | |
if [ -n "$(curl -s -H "Authorization: ${{ secrets.MODRINTH_TOKEN }}" https://api.modrinth.com/v2/user | grep "unauthorized")" ]; then | |
echo "Modrinth Token is invalid!" | |
exit 1 | |
fi | |
build: | |
name: Build, collect info, parse changelog | |
needs: checking | |
runs-on: ubuntu-latest | |
outputs: | |
JAR_FILE: ${{ steps.collect_info.outputs.JAR_FILE }} | |
MINECRAFT_VERSION: ${{ steps.collect_info.outputs.MINECRAFT_VERSION }} | |
MOD_VERSION: ${{ steps.collect_info.outputs.MOD_VERSION }} | |
RELEASE_TYPE: ${{ steps.collect_info.outputs.RELEASE_TYPE }} | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DIST }} | |
cache: gradle | |
- name: Cleanup Gradle Cache | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties | |
- name: Make Gradle executable | |
run: chmod +x ./gradlew | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Assemble the JARs | |
run: ./gradlew assemble | |
- name: Move JARs to central directory | |
run: | | |
mkdir output | |
mv -f build/libs/*.jar output/ | |
- name: Collect version information | |
id: collect_info | |
run: | | |
shopt -s failglob # print a warning if a glob does not match anything | |
set_var() { | |
echo $1="$2" | |
echo $1="$2" >> $GITHUB_OUTPUT | |
declare -g $1="$2" | |
} | |
set_var JAR_FILE $(eval echo output/${{ env.MOD_ID }}-forge-*-*.jar) | |
set_var MINECRAFT_VERSION $(echo ${JAR_FILE%.*} | cut -d- -f3) | |
set_var MOD_VERSION $(echo ${JAR_FILE%.*} | cut -d- -f4) | |
set_var RELEASE_TYPE "$(echo ${GITHUB_REF##*/} | cut -d- -f4)" | |
set_var RELEASE_TYPE "$([[ -z $RELEASE_TYPE ]] && echo release || echo $RELEASE_TYPE)" | |
- name: Install changelog parser | |
uses: taiki-e/install-action@parse-changelog | |
- name: Parse changelog | |
run: parse-changelog CHANGELOG.md ${{ steps.collect_info.outputs.MOD_VERSION }} > output/changelog.md | |
- name: Archive results | |
run: tar -zcvf build.tar.gz output | |
- name: Upload results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: build.tar.gz | |
if-no-files-found: error | |
retention-days: 3 | |
- name: Job Summary | |
run: | | |
echo "# Version Information" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "- Minecraft Version: ${{ steps.collect_info.outputs.MINECRAFT_VERSION }}" >> $GITHUB_STEP_SUMMARY | |
echo "- Mod Version: ${{ steps.collect_info.outputs.MOD_VERSION }}" >> $GITHUB_STEP_SUMMARY | |
echo "- Release Type: ${{ steps.collect_info.outputs.RELEASE_TYPE }}" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "# Build Information" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "- JAR files: $(find output -maxdepth 1 -type f -name '*.jar' | wc -l)" >> $GITHUB_STEP_SUMMARY | |
echo "- Folder size: $(du -sh output | cut -f1)" >> $GITHUB_STEP_SUMMARY | |
echo "- Archive size: $(du -sh build.tar.gz | cut -f1)" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "# Changelog" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
cat output/changelog.md >> $GITHUB_STEP_SUMMARY | |
mr-forge-release: | |
name: Modrinth Forge Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- name: Extract build artifacts | |
run: tar -zxvf build.tar.gz | |
- name: Release Forge on Modrinth | |
uses: Kir-Antipov/[email protected] | |
with: | |
modrinth-id: ${{ env.MODRINTH_ID }} | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
files: output/*forge*.jar | |
name: ${{ env.MOD_NAME }}-Forge-${{ needs.build.outputs.MINECRAFT_VERSION }}-${{ needs.build.outputs.MOD_VERSION }} | |
version: ${{ needs.build.outputs.MINECRAFT_VERSION }}-${{ needs.build.outputs.MOD_VERSION }}+forge | |
version-type: ${{ needs.build.outputs.RELEASE_TYPE }} | |
changelog-file: output/changelog.md | |
loaders: | | |
forge | |
neoforge | |
game-versions: ${{ needs.build.outputs.MINECRAFT_VERSION }} | |
java: ${{ env.JAVA_VERSION }} | |
dependencies: | | |
kubejs(required){curseforge:238086}{modrinth:umyGl7zF} | |
enderio(required){curseforge:64578}{modrinth:49ZofO4f} | |
jei(optional){curseforge:238222}{modrinth:u6dRKJwZ} | |
cf-forge-release: | |
name: CurseForge Forge Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- name: Extract build artifacts | |
run: tar -zxvf build.tar.gz | |
- name: Release Forge on CurseForge | |
uses: Kir-Antipov/[email protected] | |
with: | |
curseforge-id: ${{ env.CURSEFORGE_ID }} | |
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
files: output/*forge*.jar | |
name: ${{ env.MOD_NAME }}-Forge-${{ needs.build.outputs.MINECRAFT_VERSION }}-${{ needs.build.outputs.MOD_VERSION }} | |
version: ${{ needs.build.outputs.MINECRAFT_VERSION }}-${{ needs.build.outputs.MOD_VERSION }}+forge | |
version-type: ${{ needs.build.outputs.RELEASE_TYPE }} | |
changelog-file: output/changelog.md | |
loaders: | | |
forge | |
neoforge | |
game-versions: ${{ needs.build.outputs.MINECRAFT_VERSION }} | |
java: ${{ env.JAVA_VERSION }} | |
dependencies: | | |
kubejs(required){curseforge:238086}{modrinth:umyGl7zF} | |
enderio(required){curseforge:64578}{modrinth:49ZofO4f} | |
jei(optional){curseforge:238222}{modrinth:u6dRKJwZ} | |
github-release: | |
name: GitHub Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- name: Extract build artifacts | |
run: tar -zxvf build.tar.gz | |
- name: Release on GitHub | |
uses: Kir-Antipov/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
files: output/*.jar | |
name: v${{ needs.build.outputs.MINECRAFT_VERSION }}-${{ needs.build.outputs.MOD_VERSION }}-Forge | |
version: ${{ needs.build.outputs.MINECRAFT_VERSION }}-${{ needs.build.outputs.MOD_VERSION }} | |
version-type: ${{ needs.build.outputs.RELEASE_TYPE }} | |
changelog-file: output/changelog.md |