Skip to content

🚧 Fix generating changelog #58

🚧 Fix generating changelog

🚧 Fix generating changelog #58

Workflow file for this run

name: Build Controllable
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/[email protected]
- name: Read modid from gradle.properties
id: mod_id
uses: Reedyuk/[email protected]
with:
path: './gradle.properties'
property: 'mod_id'
- name: Read mod version from gradle.properties
id: mod_version
uses: Reedyuk/[email protected]
with:
path: './gradle.properties'
property: 'mod_version'
- name: Read minecraft version from gradle.properties
id: mc_version
uses: Reedyuk/[email protected]
with:
path: './gradle.properties'
property: 'minecraft_version'
- name: Cache
uses: actions/[email protected]
with:
path: ~/.gradle/caches
key: gradle-minecraft-${{ steps.mc_version.outputs.value }}
- 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: 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: Build (Common)
env:
GPR_USER: "MrCrayfish"
GPR_KEY: ${{ secrets.GPR_TOKEN }}
PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }}
run: ./gradlew :common:build
- name: Build (NeoForge)
env:
GPR_USER: "MrCrayfish"
GPR_KEY: ${{ secrets.GPR_TOKEN }}
PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }}
run: ./gradlew :neoforge:build
- name: Build (Fabric)
env:
GPR_USER: "MrCrayfish"
GPR_KEY: ${{ secrets.GPR_TOKEN }}
PACKAGES_REPO: ${{ vars.PACKAGES_REPOSITORY }}
run: ./gradlew :fabric:build
- 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: Construct artifact files
id: artifacts
run: |
echo "neoforge=neoforge/build/libs/${{ steps.mod_id.outputs.value }}-neoforge-${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}-release.jar" >> "$GITHUB_OUTPUT"
echo "fabric=fabric/build/libs/${{ steps.mod_id.outputs.value }}-fabric-${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}-release.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: 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.neoforge }}
gpg --batch --yes --passphrase "${{ env.SIGNING_PASSPHRASE }}" --armor --detach-sign ${{ steps.artifacts.outputs.fabric }}
- name: Create Changelog Files
run: |
echo "### Technical Changelog:" >> RELEASE_BODY.md
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
echo "### Download:" >> RELEASE_BODY.md
echo "- Official Website: https://mrcrayfish.com/mods/${{ steps.mod_id.outputs.value }}" >> RELEASE_BODY.md
echo "- CurseForge: https://curseforge.com/minecraft/mc-mods/controllable" >> RELEASE_BODY.md
git log "$previous_tag..$latest_tag^" --oneline --pretty="%s" > CHANGELOG.txt
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: '${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}'
artifacts: "${{ steps.artifacts.outputs.neoforge }},${{ steps.artifacts.outputs.neoforge }}.asc,${{ steps.artifacts.outputs.fabric }},${{ steps.artifacts.outputs.fabric }}.asc,CHANGELOG.txt"
bodyFile: "RELEASE_BODY.md"
- name: Upload NeoForge Artifacts
uses: actions/upload-artifact@v4
with:
name: '${{ steps.mod_id.outputs.value }}-neoforge-${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}'
path: |
${{ steps.artifacts.outputs.neoforge }}
${{ steps.artifacts.outputs.neoforge }}.asc
- name: Upload Fabric Artifacts
uses: actions/upload-artifact@v4
with:
name: '${{ steps.mod_id.outputs.value }}-fabric-${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}'
path: |
${{ steps.artifacts.outputs.fabric }}
${{ steps.artifacts.outputs.fabric }}.asc