Skip to content

refactor(IRC): ๐Ÿ—‘๏ธ clean old files #6

refactor(IRC): ๐Ÿ—‘๏ธ clean old files

refactor(IRC): ๐Ÿ—‘๏ธ clean old files #6

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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
paths:
- '**.java'
- '**.json'
- 'gradle**'
- 'build.gradle'
pull_request:
paths:
- '**.java'
- '**.json'
- 'gradle**'
- 'build.gradle'
# Makes it possible to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew build --stacktrace
- name: Send JAR to Discord Webhook
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
GITHUB_REPOSITORY: ${{ github.repository }}
GIT_COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }}
GIT_COMMIT_URL: ${{ github.event.head_commit.url }}
GIT_COMMIT_TIMESTAMP: ${{ github.event.head_commit.timestamp }}
GIT_COMMIT_ID: ${{ github.event.head_commit.id }}
GIT_COMMIT_COMMENT_COUNT: ${{ github.event.head_commit.comment_count }}
run: |
JAR_PATH=$(find build/libs -name "*.jar" | head -n 1)
if [ -z "$JAR_PATH" ]; then
echo "No JAR file found"
exit 1
fi
FILENAME=$(basename $JAR_PATH)
curl -X POST -H "Content-Type: multipart/form-data" \
-F "file=@$JAR_PATH" \
-F "payload_json={\"content\":\"$GIT_COMMIT_AUTHOR pushed $GIT_COMMIT_COMMENT_COUNT changes to the repository $GITHUB_REPOSITORY on branch $GITHUB_REF. Commit URL: $GIT_COMMIT_URL\"}" \
$DISCORD_WEBHOOK_URL