🏷 Updated version and trigger build #22
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 and Sign Mod (Forge) | |
on: | |
push: | |
paths: | |
- 'release_build_forge' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: Build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v3 | |
- name: Read mod data from gradle.properties | |
id: mod_data | |
uses: christian-draeger/[email protected] | |
with: | |
path: './gradle.properties' | |
properties: 'mod_id mod_version minecraft_version' | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: gradle-minecraft-${{ steps.mod_data.outputs.minecraft_version }}-forge | |
- name: Load Keystore | |
id: load_keystore | |
env: | |
JKS: ${{ secrets.MRCRAYFISH_JKS }} | |
if: ${{ env.JKS != '' }} | |
uses: timheuer/[email protected] | |
with: | |
fileName: 'keystore.jks' | |
encodedString: ${{ env.JKS }} | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Build and Publish | |
env: | |
TARGET_LOADER: "forge" | |
GPR_USER: "MrCrayfish" | |
GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
KEYSTORE: ${{ steps.load_keystore.outputs.filePath }} | |
KEYSTORE_ALIAS: ${{ secrets.MRCRAYFISH_JKS_ALIAS }} | |
KEYSTORE_PASS: ${{ secrets.MRCRAYFISH_JKS_PASSPHRASE }} | |
run: ./gradlew :forge:build :forge:publish | |
- name: Stop Gradle | |
run: ./gradlew --stop | |
- name: Construct artifact files | |
id: artifacts | |
run: | | |
echo "forge=forge/build/libs/${{ steps.mod_data.outputs.mod_id }}-forge-${{ steps.mod_data.outputs.minecraft_version }}-${{ steps.mod_data.outputs.mod_version }}.jar" >> "$GITHUB_OUTPUT" | |
- name: Import GPG | |
env: | |
SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
if: ${{ env.SIGNING_KEY != '' && env.SIGNING_PASSPHRASE != '' }} | |
uses: crazy-max/[email protected] | |
with: | |
gpg_private_key: ${{ env.SIGNING_KEY }} | |
passphrase: ${{ env.SIGNING_PASSPHRASE }} | |
- name: Sign JAR | |
env: | |
SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
if: ${{ env.SIGNING_PASSPHRASE != '' }} | |
run: | | |
gpg --batch --yes --passphrase "${{ env.SIGNING_PASSPHRASE }}" --armor --detach-sign ${{ steps.artifacts.outputs.forge }} | |
- name: Upload Forge Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ steps.mod_data.outputs.mod_id }}-forge-${{ steps.mod_data.outputs.minecraft_version }}-${{ steps.mod_data.outputs.mod_version }}' | |
path: | | |
${{ steps.artifacts.outputs.forge }} | |
${{ steps.artifacts.outputs.forge }}.asc |