build: bump modpublisher & parchment (#257) #117
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 | |
on: | |
push: | |
pull_request: | |
# Only allow running one build job at a time to optimise cache hits | |
concurrency: | |
group: builds | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# Avoid duplicate runs when both `push` and `pull_request` are triggered: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Calculate metadata | |
id: data | |
run: | | |
# Calculate data | |
full="${{ github.sha }}" | |
short="${full:0:6}" | |
date="$(date --utc +'%Y-%m-%d_%H-%M-%S')" | |
forge="$(grep --max-count=1 --only-matching --word-regexp '\(neo\)\?forge' gradle.properties)" | |
minecraft="$(sed -ne 's/^\s*minecraft_version\s*=\s*\(.*\)$/\1/p' gradle.properties)" | |
# Print to output | |
echo "full_sha=$full" >> $GITHUB_OUTPUT | |
echo "short_sha=$short" >> $GITHUB_OUTPUT | |
echo "date=$date" >> $GITHUB_OUTPUT | |
echo "forge_name=$forge" >> $GITHUB_OUTPUT | |
echo "minecraft=$minecraft" >> $GITHUB_OUTPUT | |
echo "name_suffix=${date}-${short}-mc${minecraft}" >> $GITHUB_OUTPUT | |
# Print to stdout too | |
echo Metadata: | |
cat $GITHUB_OUTPUT | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: microsoft | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build | |
run: ./gradlew build | |
# Upload separately, or they'll be zipped together | |
- name: Upload all builds | |
uses: actions/upload-artifact@v4 | |
with: | |
name: all-builds-${{ steps.data.outputs.name_suffix }}.zip | |
path: build/libs | |
retention-days: 30 | |
if-no-files-found: error | |
- name: Upload Fabric build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: freecam-fabric-${{ steps.data.outputs.name_suffix }}.jar | |
path: | | |
build/libs/*-fabric-*.jar | |
!**-modrinth-*.jar | |
retention-days: 90 | |
if-no-files-found: error | |
- name: Upload Forge build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: freecam-${{ steps.data.outputs.forge_name }}-${{ steps.data.outputs.name_suffix }}.jar | |
path: | | |
build/libs/*-${{ steps.data.outputs.forge_name }}-*.jar | |
!**-modrinth-*.jar | |
retention-days: 90 | |
if-no-files-found: error |