Skip to content

发布

发布 #11

Workflow file for this run

name: 发布
on:
workflow_dispatch:
env:
JAVA_8_LIST: '["forge-1.16.5"]'
JAVA_17_LIST: '["fabric-1.16.5","fabric-1.18.2","fabric-1.19.1","fabric-1.19.2","fabric-1.19.3","fabric-1.19.4","fabric-1.20","fabric-1.20.3","forge-1.18.2","forge-1.19","forge-1.20","forge-1.20.2","forge-1.20.3"]'
JAVA_21_LIST: '["fabric-1.20.5","fabric-1.21","fabric-1.21.2","neoforge-1.20.2","neoforge-1.20.3","neoforge-1.20.4","neoforge-1.20.5","neoforge-1.21.0","neoforge-1.21.2",]'
permissions:
contents: write
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","neoforge"
build:
runs-on: windows-latest
needs: generate-matrix
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Chose JDK 8
uses: actions/setup-java@v4
if: contains(env.JAVA_8_LIST, format('{0}-{1}', matrix.config.mc-loader,matrix.config.mc-version))
with:
java-version: '8'
distribution: 'temurin'
- name: Chose JDK 17
uses: actions/setup-java@v4
if: contains(env.JAVA_17_LIST, format('{0}-{1}', matrix.config.mc-loader,matrix.config.mc-version))
with:
java-version: '17'
distribution: 'temurin'
- name: Chose JDK 21
uses: actions/setup-java@v4
if: contains(env.JAVA_21_LIST, format('{0}-{1}', matrix.config.mc-loader,matrix.config.mc-version))
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
run: |
cd ${{ matrix.config.mc-loader }}/${{ matrix.config.mc-loader }}-${{ matrix.config.mc-version }}
./gradlew clean build
cd ../..
- uses: Kir-Antipov/[email protected]
with:
modrinth-id: zhVN1dvW
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 818089
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: ChatImage-${{ env.MOD_VERSION }}+${{ matrix.config.mc-version }}+${{ matrix.config.mc-loader }}.jar
version: ${{ env.MOD_VERSION }}
version-type: "beta"
loaders: ${{ matrix.config.mc-loader }}
game-versions: ${{ matrix.config.mc-version }}
game-version-filter: releases
files: ChatImage-jar/${{ env.MOD_VERSION }}/ChatImage-${{ env.MOD_VERSION }}+${{ matrix.config.mc-version }}+${{ matrix.config.mc-loader }}.jar