Skip to content

[Chore]: Fix merge issues #116

[Chore]: Fix merge issues

[Chore]: Fix merge issues #116

Workflow file for this run

name: 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 21
uses: actions/setup-java@v4
with:
java-version: 21
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
env:
USERNAME: ${{ secrets.USERNAME }}
READ_PACKAGES_TOKEN: ${{ secrets.READ_PACKAGES_TOKEN }}
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