Skip to content

Update actions/setup-java action to v4 #145

Update actions/setup-java action to v4

Update actions/setup-java action to v4 #145

Workflow file for this run

name: Build Attollo
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
jobs:
build:
# Run on all label events (won't be duplicated) or all push events or on PR syncs not from the same repo
if: github.repository_owner == 'OneLiteFeatherNET'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
cache: gradle
java-version: 17
- name: Clean Build
run: ./gradlew clean build --no-daemon
- name: Determine release status
if: ${{ runner.os == 'Linux' }}
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: Attollo Archive
path: build/libs/Attollo-*.jar
- name: Publish to hangar
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
HANGAR_SECRET: ${{secrets.HANGAR_KEY}}
HANGAR_CHANNEL: "Release"
- name: Publish to hangar snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew publishAllPublicationsToHangar --no-daemon
env:
HANGAR_SECRET: ${{secrets.HANGAR_KEY}}
HANGAR_CHANNEL: "Snapshot"
- name: Publish to Modrinth
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew modrinth --no-daemon
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
MODRINTH_CHANNEL: "release"
SHA_SHORT: ${{steps.vars.outputs.sha_short}}
- name: Publish to Modrinth Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master'}}
run: ./gradlew modrinth --no-daemon
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_KEY }}
MODRINTH_CHANNEL: "beta"