Skip to content

build

build #13

Workflow file for this run

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: 'temurin'
java-version: '17'
- name: Validate gradlew integrity
uses: gradle/wrapper-validation-action@v1
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties') }}
- name: Build with Gradle
run: ./gradlew pmdMain 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: |
VERSION=$(awk -F '=' '/^version/ { print $2; }' build.properties)
BUILD=$(awk -F '=' '/build_number/ { print $2; }' build.properties)
echo "forge=build/libs/Morph-o-Tool-${VERSION}-${BUILD}.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.forge }}
- name: Archive Forge Artifacts
uses: actions/upload-artifact@v2
with:
name: Forge
path: |
${{ steps.calculate_artifact_names.outputs.forge }}
${{ steps.calculate_artifact_names.outputs.forge }}.asc
- name: Upload Releases
if: startsWith(github.ref, 'refs/tags/release-')
env:
GH_TOKEN: ${{ github.token }}
GIT_REF: ${{ github.ref }}
FORGE_JAR: ${{ steps.calculate_artifact_names.outputs.forge }}
CURSEFORGE_TOKEN: ${{ secrets.VAZKII_CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.VAZKII_MODRINTH_TOKEN }}
run: |
scripts/upload_releases.sh