LandOfSignals Publish Pipeline #38
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: LandOfSignals Publish Pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'Type of release' | |
required: true | |
default: 'release' | |
type: choice | |
options: | |
- alpha | |
- beta | |
- release | |
jobs: | |
versioncommit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Read VERSION file | |
id: getversion | |
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
- name: Read SUFFIX file | |
id: getsuffix | |
run: echo "suffix=$(cat SUFFIX)" >> $GITHUB_OUTPUT | |
- name: Replace version number with new version | |
run: | | |
sed -i 's/public static final String VERSION.*/public static final String VERSION = "${{ steps.getversion.outputs.version }}";/' src/main/java/net/landofrails/landofsignals/LandOfSignals.java | |
sed -i '0,/"version":.*/s//"version": "${{ steps.getversion.outputs.version }}",/' ./umc.json | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "MarkenJaden" | |
git config --global user.email "[email protected]" | |
git add -A | |
git diff-index --quiet HEAD || git commit -m "Updated mod version" | |
git push | |
build: | |
runs-on: ubuntu-latest | |
needs: [ versioncommit ] | |
strategy: | |
max-parallel: 1 | |
matrix: | |
branch: [1.7.10-forge, 1.10.2-forge, 1.11.2-forge, 1.12.2-forge, 1.14.4-forge, 1.15.2-forge, 1.16.5-forge] | |
include: | |
- branch: 1.7.10-forge | |
version: 1.7.10 | |
- branch: 1.10.2-forge | |
version: 1.10.2 | |
- branch: 1.11.2-forge | |
version: 1.11.2 | |
- branch: 1.12.2-forge | |
version: 1.12.2 | |
- branch: 1.14.4-forge | |
version: 1.14.4 | |
- branch: 1.15.2-forge | |
version: 1.15.2 | |
- branch: 1.16.5-forge | |
version: 1.16.5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
- name: Install deps | |
run: sudo apt install -y pngquant findutils xvfb | |
- name: Setup Universal Mod Core (and helpers) | |
env: | |
BRANCH: ${{ matrix.branch }} | |
run: java -jar UMCSetup.jar ${BRANCH} https | |
- name: Gradle compile | |
run: ./gradlew classes | |
- name: Process images | |
run: find src/main/resources/assets/landofsignals/ | grep png | xargs -I foo pngquant -s1 -f --ext .png foo | |
- name: Run Data (optionalish) | |
run: xvfb-run --auto-servernum ./gradlew runData || xvfb-run --auto-servernum ./gradlew runData || true | |
- name: Gradle build | |
run: ./gradlew build -Dtarget=release | |
- name: Read CHANGELOG.md file | |
id: getchangelog | |
uses: juliangruber/[email protected] | |
with: | |
path: ./CHANGELOG.md | |
- name: Read VERSION file | |
id: getversion | |
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
- name: Read SUFFIX file | |
id: getsuffix | |
run: echo "suffix=$(cat SUFFIX)" >> $GITHUB_OUTPUT | |
- name: Rename with suffix | |
run: | | |
ls ./build/libs/ | |
mv -n build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}.jar build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }}.jar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: LandOfSignals ${{matrix.branch}} | |
path: build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }}.jar | |
- name: Upload ${{matrix.branch}} | |
uses: Kir-Antipov/[email protected] | |
with: | |
# Modrinth | |
modrinth-id: r7aBIx6Q | |
modrinth-featured: true | |
modrinth-unfeature-mode: subset | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
# CurseForge | |
curseforge-id: 434307 | |
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
curseforge-dependencies: | | |
universal-mod-core | depends | * | |
files: build/libs/LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }}.jar | |
name: LandOfSignals-${{matrix.branch}}-${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} | |
version: ${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} | |
version-type: ${{ inputs.type }} | |
changelog-file: ./CHANGELOG.md | |
loaders: | | |
forge | |
game-versions: | | |
${{ matrix.version }} | |
java: | | |
8 | |
retry-attempts: 2 | |
retry-delay: 10000 | |
fail-mode: fail | |
package: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Read VERSION file | |
id: getversion | |
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
- name: Read SUFFIX file | |
id: getsuffix | |
run: echo "suffix=$(cat SUFFIX)" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v4 | |
- run: mkdir upload | |
- run: cp **/LandOfSignals-*.jar upload | |
- name: Upload to GitHub | |
uses: Kir-Antipov/[email protected] | |
with: | |
# GitHub | |
github-tag: v${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} | |
github-generate-changelog: true | |
github-draft: false | |
github-prerelease: false | |
github-discussion: Announcements | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
files: upload/LandOfSignals-*.jar | |
version: ${{ steps.getversion.outputs.version }}${{ steps.getsuffix.outputs.suffix }} | |
version-type: ${{ inputs.type }} | |
changelog-file: ./CHANGELOG.md | |
loaders: | | |
forge | |
game-versions: | | |
1.7.10 | |
1.10.2 | |
1.11.2 | |
1.12.2 | |
1.14.4 | |
1.15.2 | |
1.16.5 | |
java: | | |
8 | |
retry-attempts: 2 | |
retry-delay: 10000 | |
fail-mode: fail |