forgot spotless #77
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@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Validate gradlew integrity | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties') }} | |
- name: Build with Gradle | |
run: ./gradlew pmdMain spotlessJavaCheck build | |
- name: PMD report | |
uses: jwgmeligmeyling/pmd-github-action@v1 | |
if: failure() | |
with: | |
path: '**/reports/pmd/main.xml' | |
- name: Stop Gradle | |
run: | | |
./gradlew --stop | |
- name: Calculate artifact names | |
id: calculate_artifact_names | |
run: | | |
MC=$(awk -F '=' '/mc_version/ { print $2; }' gradle.properties) | |
BUILD=$(awk -F '=' '/build_number/ { print $2; }' gradle.properties) | |
echo "neoforge=NeoForge/build/libs/Neat-${MC}-${BUILD}-NEOFORGE.jar" >> "$GITHUB_OUTPUT" | |
echo "fabric=Fabric/build/libs/Neat-${MC}-${BUILD}-FABRIC.jar" >> "$GITHUB_OUTPUT" | |
- name: Sign jars | |
env: | |
SIGNING_KEY: ${{ secrets.VIOLET_MOON_SIGNING_KEY }} | |
if: ${{ env.SIGNING_KEY != '' }} | |
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 Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NeoForge | |
path: | | |
${{ steps.calculate_artifact_names.outputs.neoforge }} | |
${{ steps.calculate_artifact_names.outputs.neoforge }}.asc | |
- name: Archive Fabric Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Fabric | |
path: | | |
${{ steps.calculate_artifact_names.outputs.fabric }} | |
${{ 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.VAZKII_CURSEFORGE_TOKEN }} | |
MODRINTH_TOKEN: ${{ secrets.VAZKII_MODRINTH_TOKEN }} | |
run: | | |
scripts/upload_releases.sh |