Merge remote-tracking branch 'origin/1.20.1-fabric-dev' into 1.20.1-f… #115
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: Mod Build | |
on: [ workflow_dispatch, push ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 200 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: zulu | |
cache: gradle | |
- name: Loom Cache | |
uses: actions/cache@v4 | |
with: | |
path: "**/.gradle/loom-cache" | |
key: "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}" | |
restore-keys: "${{ runner.os }}-gradle-" | |
- uses: gradle/actions/wrapper-validation@v4 | |
- run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Read minecraft version from gradle.properties | |
id: read-version | |
run: | | |
minecraft_version=$(grep '^minecraft_version=' gradle.properties | cut -d'=' -f2) | |
echo "minecraft_version=$minecraft_version" >> $GITHUB_ENV | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SophisticatedCore-${{ env.minecraft_version }} | |
path: build/libs | |
- name: Publish to Github Packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew publish | |
- name: Cleanup old artifacts | |
uses: actions/delete-package-versions@v5 | |
with: | |
package-name: 'sophisticatedcore.sophisticatedcore' | |
package-type: 'maven' | |
min-versions-to-keep: 10 | |
- name: Publish to CurseForge | |
env: | |
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | |
run: | | |
BRANCH_NAME=${GITHUB_REF##*/} | |
if [[ "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+\.([0-9]+|x)-fabric$ ]]; then | |
./gradlew curseforge | |
else | |
echo "Branch name does not match the pattern: $BRANCH_NAME. Skipping CurseForge upload." | |
exit 0 | |
fi | |
- name: Publish to Modrinth | |
env: | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
run: | | |
BRANCH_NAME=${GITHUB_REF##*/} | |
if [[ "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+\.([0-9]+|x)-fabric$ ]]; then | |
./gradlew modrinth | |
else | |
echo "Branch name does not match the pattern: $BRANCH_NAME. Skipping Modrinth upload." | |
exit 0 | |
fi |