Fire an advancement trigger when reading a book #844
Workflow file for this run
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: Java CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Validate gradlew integrity | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Restore cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }} | |
- name: Build | |
run: | | |
RELEASE_MODE=${{ startsWith(github.ref, 'refs/tags/release-') && '1' || '0' }} \ | |
./gradlew pmdMain spotlessJavaCheck build | |
- name: PMD report | |
uses: jwgmeligmeyling/pmd-github-action@v1 | |
if: failure() | |
with: | |
path: '**/reports/pmd/main.xml' | |
- name: Run GameTests (Fabric) | |
run: ./gradlew :Fabric:runGameTest | |
- name: Stop Gradle | |
run: | | |
./gradlew --stop | |
- name: Calculate artifact names | |
id: calculate_artifact_names | |
run: | | |
# Check is backwards because "" is falsey, which wouldn't work for boolean punning | |
SNAPSHOT_SUFFIX=${{ !startsWith(github.ref, 'refs/tags/release-') && '-SNAPSHOT' || '' }} | |
MC=$(awk -F '=' '/mc_version/ { print $2; }' gradle.properties) | |
BUILD=$(awk -F '=' '/build_number/ { print $2; }' gradle.properties) | |
echo "neoforge=NeoForge/build/libs/Patchouli-${MC}-${BUILD}-NEOFORGE${SNAPSHOT_SUFFIX}.jar" >> "$GITHUB_OUTPUT" | |
echo "fabric=Fabric/build/libs/Patchouli-${MC}-${BUILD}-FABRIC${SNAPSHOT_SUFFIX}.jar" >> "$GITHUB_OUTPUT" | |
- name: Sign jars | |
env: | |
SIGNING_KEY: ${{ secrets.VIOLET_MOON_SIGNING_KEY }} | |
if: ${{ env.SIGNING_KEY != '' && startsWith(github.ref, 'refs/tags/release-')}} | |
run: | | |
echo "${SIGNING_KEY}" | gpg --import - | |
gpg --local-user "Violet Moon Signing Key" --armor \ | |
--detach-sign ${{ steps.calculate_artifact_names.outputs.neoforge }} | |
gpg --local-user "Violet Moon Signing Key" --armor \ | |
--detach-sign ${{ steps.calculate_artifact_names.outputs.fabric }} | |
- name: Archive NeoForge Jar | |
uses: actions/upload-artifact@v2 | |
with: | |
name: NeoForge Jar | |
path: | | |
${{ steps.calculate_artifact_names.outputs.neoforge }} | |
- name: Archive NeoForge Signature | |
uses: actions/upload-artifact@v2 | |
if: ${{ env.SIGNING_KEY != '' && startsWith(github.ref, 'refs/tags/release-')}} | |
with: | |
name: NeoForge Signature | |
path: | | |
${{ steps.calculate_artifact_names.outputs.neoforge }}.asc | |
- name: Archive Fabric Jar | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Fabric Jar | |
path: | | |
${{ steps.calculate_artifact_names.outputs.fabric }} | |
- name: Archive Fabric Signature | |
uses: actions/upload-artifact@v2 | |
if: ${{ env.SIGNING_KEY != '' && startsWith(github.ref, 'refs/tags/release-')}} | |
with: | |
name: Fabric Signature | |
path: | | |
${{ steps.calculate_artifact_names.outputs.fabric }}.asc | |
- name: Upload Releases | |
if: startsWith(github.ref, 'refs/tags/release-') | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GIT_REF: ${{ github.ref }} | |
FABRIC_JAR: ${{ steps.calculate_artifact_names.outputs.fabric }} | |
NEOFORGE_JAR: ${{ steps.calculate_artifact_names.outputs.neoforge }} | |
CURSEFORGE_TOKEN: ${{ secrets.WILLIEWILLUS_CURSEFORGE_TOKEN }} | |
MODRINTH_TOKEN: ${{ secrets.WILLIEWILLUS_MODRINTH_TOKEN }} | |
run: | | |
scripts/upload_releases.sh |