Merge pull request #22 from Erdragh/feature/multiloader-template #149
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: build | |
on: | |
push: | |
branches: [ "main", "develop", "version/*" ] | |
pull_request: | |
branches: [ "main", "develop", "version/*" ] | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: Publish to Modrinth and CurseForge | |
required: true | |
default: "false" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
# Use these Java versions | |
java: [ | |
17, # Current Java LTS & minimum supported by Minecraft | |
] | |
# and run on Linux | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup jdk ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
- name: Prepare Changelog | |
run: ./gradlew -q prepareChangelog > prepared_changelog.md | |
- name: Capture Fabric Artifacts | |
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-fabric | |
path: fabric/build/libs | |
- name: Capture Neo Artifacts | |
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-neo | |
path: neoforge/build/libs | |
- name: Capture Changelog | |
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-changelog | |
path: prepared_changelog.md | |
publish: | |
if: ${{ github.event.inputs.publish }} | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download Fabric artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build/fabric | |
pattern: build-fabric | |
merge-multiple: true | |
- name: Download Neo artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build/neo | |
pattern: build-neo | |
merge-multiple: true | |
- name: Download Changelog | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: build-changelog | |
- name: List build artifacts | |
run: ls -R build | |
- name: Show Changelog | |
run: cat build-changelog/prepared_changelog.md | |
- name: Get Version and Platform | |
id: properties | |
uses: christian-draeger/[email protected] | |
with: | |
path: "./gradle.properties" | |
properties: "version enabledPlatforms minecraftVersion" | |
- name: Upload Neo Releases (Curse/Modrinth) | |
id: neo_release | |
if: contains(steps.properties.outputs.enabledPlatforms, 'neoforge') | |
uses: Kir-Antipov/[email protected] | |
with: | |
curseforge-id: ${{ vars.CURSE_ID }} | |
curseforge-token: ${{ secrets.CURSE_TOKEN }} | |
modrinth-id: ${{ vars.MODRINTH_ID }} | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
files: ./build/forge/!(*-@(dev|sources|dev-shadow)).jar | |
name: "AstralBot ${{ steps.properties.outputs.version }} NeoForge ${{ steps.properties.output.minecraftVersion }}" | |
version: ${{ steps.properties.outputs.version }} | |
version-type: release | |
changelog-file: build-changelog/prepared_changelog.md | |
loaders: forge | |
game-versions: ${{ steps.properties.outputs.minecraftVersion }} | |
curseforge-dependencies: | | |
kotlin-for-forge(required) | |
forge-config-api-port-fabric(required) | |
modrinth-dependencies: | | |
kotlin-for-forge(required) | |
forge-config-api-port(required) | |
- name: Upload Fabric Releases (Curse/Modrinth) | |
id: fabric_release | |
if: contains(steps.properties.outputs.enabledPlatforms, 'fabric') | |
uses: Kir-Antipov/[email protected] | |
with: | |
curseforge-id: ${{ vars.CURSE_ID }} | |
curseforge-token: ${{ secrets.CURSE_TOKEN }} | |
modrinth-id: ${{ vars.MODRINTH_ID }} | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
files: ./build/fabric/!(*-@(dev|sources|dev-shadow)).jar | |
name: "AstralBot ${{ steps.properties.outputs.version }} Fabric ${{ steps.properties.output.minecraftVersion }}" | |
version: ${{ steps.properties.outputs.version }} | |
version-type: release | |
changelog-file: build-changelog/prepared_changelog.md | |
loaders: fabric | |
game-versions: ${{ steps.properties.outputs.minecraftVersion }} | |
curseforge-dependencies: | | |
fabric-api(required) | |
fabric-language-kotlin(required) | |
forge-config-api-port-fabric(required) | |
modrinth-dependencies: | | |
fabric-api(required) | |
fabric-language-kotlin(required) | |
forge-config-api-port(required) |