Add a Discord webhook to the GH Action #546
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: Gradle build | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Gradle stuff | |
uses: actions/cache@v3 | |
with: | |
key: gradle-${{ hashFiles('build.gradle.kts', 'settings.gradle.kts', 'gradle.properties', 'gradle/**') }} | |
restore-keys: | | |
gradle-${{ hashFiles('build.gradle.kts', 'settings.gradle.kts', 'gradle.properties', 'gradle/**') }} | |
gradle- | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
.gradle/quilt-loom-cache | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Capture build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Artifact | |
path: build/libs/ | |
# The following is based off of https://github.com/Cannoneers-of-Create/CreateBigCannons/blob/1.18.2/dev/.github/workflows/gradle.yml | |
- name: Send building message to discord | |
if: github.event_name == 'push' && github.repository_id == '344617531' | |
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 == '344617531' | |
uses: sinshutu/upload-to-discord@master | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
with: | |
args: build/libs/ |