Skip to content

Build Plugin and Mod #39

Build Plugin and Mod

Build Plugin and Mod #39

Workflow file for this run

name: Build Plugin and Mod
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
jobs:
generate-matrix:
runs-on: windows-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Generate Matrix
id: set-matrix
shell: pwsh
run: .\matrix.ps1 -path "fabric","forge","spigot","velocity"
build:
runs-on: windows-latest
needs:
- generate-matrix
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Chose JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Read version.txt and save to variable
shell: pwsh
run: |
$mod_version = Get-Content version.txt
Write-Host "Version: $mod_version"
echo "MOD_VERSION=$mod_version" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV
- name: Init Files
shell: pwsh
run: ./init.ps1
- name: Build
env:
USERNAME: ${{ github.actor }}
PACKAGE_READ_ONLY_TOKEN: ${{ secrets.PACKAGE_READ_ONLY_TOKEN }}
run: |
cd ${{ matrix.config.mc-loader }}/${{ matrix.config.mc-loader }}-${{ matrix.config.mc-version }}
./gradlew clean build
cd ../..
- uses: actions/upload-artifact@v4
with:
name: QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}.jar
path: QueQiao-jar/${{ env.MOD_VERSION }}/QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}.jar
- uses: Kir-Antipov/mc-publish@v3.3
if: ${{ matrix.config.mc-loader == 'forge' }} || ${{ matrix.config.mc-loader == 'fabric' }}
with:
modrinth-id: AANobbMI
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 394468
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}
version: ${{ env.MOD_VERSION }}
version-type: release
loaders: ${{ matrix.config.loaders }}
game-versions: ${{ matrix.config.mc-version }}
files: QueQiao-jar/${{ env.MOD_VERSION }}/QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}.jar
- name: Upload to Release
if: ${{ github.event_name == 'push' }}
run: gh release upload v${{ env.MOD_VERSION }} QueQiao-jar/${{ env.MOD_VERSION }}/QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}.jar