Skip to content

Java CI with Gradle #45

Java CI with Gradle

Java CI with Gradle #45

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Get branch name
id: get_branch
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Get latest commit hash
id: get_hash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get MC version
uses: christian-draeger/read-properties@908f99d3334be3802ec7cb528395a69d19914e7b
id: get_mc_version
with:
path: gradle.properties
properties: mc_version
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@9aa31f26bc8e536d1faf4b332bb8365350743a18
- name: Build jar
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Send building message to discord
if: github.event_name == 'push' && github.repository_id == '497754645'
uses: realRobotix/action-discord-notifier@release-master
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
message-title: Building mod from branch ${{ steps.get_branch.outputs.branch }}
- name: Send built file to discord
if: github.event_name == 'push' && github.repository_id == '497754645'
uses: sinshutu/upload-to-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: ./build/libs/*.*
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: technomancy-${{ steps.get_mc_version.outputs.mc_version }}-nightly-${{ steps.get_hash.outputs.sha_short }}
path: build/libs/