🏷️ Update mod verison #26
Workflow file for this run
This file contains hidden or 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 Backpacked | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: Build | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Validate Gradle Wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Read mod data from gradle.properties | |
| id: mod_data | |
| uses: christian-draeger/read-properties@1.1.1 | |
| with: | |
| path: './gradle.properties' | |
| properties: 'mod_id mod_version minecraft_version' | |
| - name: Cache | |
| uses: actions/cache@v4.2.0 | |
| with: | |
| path: ~/.gradle/caches | |
| key: gradle-minecraft-${{ steps.mod_data.outputs.minecraft_version }} | |
| restore-keys: | | |
| gradle-minecraft-${{ steps.mod_data.outputs.minecraft_version }} | |
| - name: Load Keystore | |
| id: load_keystore | |
| env: | |
| JKS: ${{ secrets.MRCRAYFISH_JKS }} | |
| if: ${{ env.JKS != '' }} | |
| uses: timheuer/base64-to-file@v1.2 | |
| with: | |
| fileName: 'keystore.jks' | |
| encodedString: ${{ env.JKS }} | |
| - name: Set Keystore Variables | |
| if: ${{ steps.load_keystore.outputs.filePath != '' }} | |
| run: | | |
| echo "KEYSTORE=${{ steps.load_keystore.outputs.filePath }}" >> $GITHUB_ENV | |
| echo "KEYSTORE_ALIAS=${{ secrets.MRCRAYFISH_JKS_ALIAS }}" >> $GITHUB_ENV | |
| echo "KEYSTORE_PASS=${{ secrets.MRCRAYFISH_JKS_PASSPHRASE }}" >> $GITHUB_ENV | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| - name: Data Generation (NeoForge) | |
| env: | |
| GPR_USER: "MrCrayfish" | |
| GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
| PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }} | |
| TARGET_LOADER: "neoforge" | |
| run: ./gradlew :neoforge:runData | |
| - name: Data Generation (Fabric) | |
| env: | |
| GPR_USER: "MrCrayfish" | |
| GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
| PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }} | |
| TARGET_LOADER: "fabric" | |
| run: ./gradlew :fabric:runDatagen | |
| - name: Build (Common) | |
| env: | |
| GPR_USER: "MrCrayfish" | |
| GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
| PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }} | |
| TARGET_LOADER: "common" | |
| run: ./gradlew :common:build | |
| - name: Build (Fabric) | |
| env: | |
| GPR_USER: "MrCrayfish" | |
| GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
| PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }} | |
| TARGET_LOADER: "fabric" | |
| run: ./gradlew :fabric:build | |
| - name: Build (NeoForge) | |
| env: | |
| GPR_USER: "MrCrayfish" | |
| GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
| PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }} | |
| TARGET_LOADER: "neoforge" | |
| run: ./gradlew :neoforge:build | |
| - name: Construct artifact files | |
| id: artifacts | |
| run: | | |
| echo "fabric=fabric/build/libs/${{ steps.mod_data.outputs.mod_id }}-fabric-${{ steps.mod_data.outputs.minecraft_version }}-${{ steps.mod_data.outputs.mod_version }}-signed.jar" >> "$GITHUB_OUTPUT" | |
| echo "neoforge=neoforge/build/libs/${{ steps.mod_data.outputs.mod_id }}-neoforge-${{ steps.mod_data.outputs.minecraft_version }}-${{ steps.mod_data.outputs.mod_version }}-signed.jar" >> "$GITHUB_OUTPUT" | |
| - name: Create Changelog Files | |
| run: | | |
| echo "" > CHANGELOG.txt | |
| echo "### Technical Changelog:" >> RELEASE_BODY.md | |
| tag_count=$(git tag --merged | wc -l) | |
| if [ "$tag_count" -ge 2 ]; then | |
| latest_tag=$(git describe --tags --abbrev=0) | |
| previous_tag=$(git describe --tags --abbrev=0 --exclude=$latest_tag) | |
| git log "$previous_tag..$latest_tag^" --oneline --pretty="- %s (%H)" >> RELEASE_BODY.md | |
| git log "$previous_tag..$latest_tag^" --oneline --pretty="%s" >> CHANGELOG.txt | |
| else | |
| echo "No changes" | |
| fi | |
| echo "### Download:" >> RELEASE_BODY.md | |
| echo "- Official Website: https://mrcrayfish.com/mods/${{ steps.mod_data.outputs.mod_id }}" >> RELEASE_BODY.md | |
| echo "- CurseForge: https://curseforge.com/minecraft/mc-mods/backpacked" >> RELEASE_BODY.md | |
| - 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/ghaction-import-gpg@v6.2.0 | |
| with: | |
| gpg_private_key: ${{ env.SIGNING_KEY }} | |
| passphrase: ${{ env.SIGNING_PASSPHRASE }} | |
| - name: GPG Sign | |
| env: | |
| SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| if: ${{ env.SIGNING_PASSPHRASE != '' }} | |
| run: | | |
| gpg --batch --yes --passphrase "${{ env.SIGNING_PASSPHRASE }}" --armor --detach-sign ${{ steps.artifacts.outputs.fabric }} | |
| gpg --batch --yes --passphrase "${{ env.SIGNING_PASSPHRASE }}" --armor --detach-sign ${{ steps.artifacts.outputs.neoforge }} | |
| - name: Publish to GitHub Packages | |
| env: | |
| GPR_USER: "MrCrayfish" | |
| GPR_KEY: ${{ secrets.GPR_TOKEN }} | |
| PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }} | |
| SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
| SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: ./gradlew publish | |
| - name: Stop Gradle | |
| run: ./gradlew --stop | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: '${{ steps.mod_data.outputs.minecraft_version }}-${{ steps.mod_data.outputs.mod_version }}' | |
| artifacts: "${{ steps.artifacts.outputs.fabric }},${{ steps.artifacts.outputs.fabric }}.asc,${{ steps.artifacts.outputs.neoforge }},${{ steps.artifacts.outputs.neoforge }}.asc,CHANGELOG.txt" | |
| bodyFile: "RELEASE_BODY.md" | |
| - name: Prepare Artifacts | |
| run: | | |
| mkdir artifacts | |
| mv ${{ steps.artifacts.outputs.neoforge }} artifacts | |
| mv ${{ steps.artifacts.outputs.neoforge }}.asc artifacts | |
| mv ${{ steps.artifacts.outputs.fabric }} artifacts | |
| mv ${{ steps.artifacts.outputs.fabric }}.asc artifacts | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: '${{ steps.mod_data.outputs.mod_id }}-${{ steps.mod_data.outputs.minecraft_version }}-${{ steps.mod_data.outputs.mod_version }}' | |
| path: artifacts | |
| - name: Delete tag on fail | |
| if: failure() | |
| run: | | |
| echo "Cleaning up tag..." | |
| git push origin :refs/tags/${{ github.ref_name }} |