Upload Builds to Discord #44
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: Upload Builds to Discord | |
on: | |
workflow_dispatch: | |
registry_package: | |
types: [published] | |
schedule: | |
- cron: '0 0 * * 5' | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
upload-to-discord: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Get Weekly Commits | |
run: | | |
echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV | |
git log --format="[\`%h\`](https://github.com/illucc/Kontraption/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Send Embedded Discord Message | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK }} | |
embed-title: "Kontraption Nightly from ${{ github.ref_name }}" | |
embed-description: | | |
Nightlies are posted every friday at 00:00 UTC | |
The nightly builds WILL have bugs and MIGHT be broken and not launch at all or corrupt your world! Use these builds with caution! | |
New commits: | |
${{ env.WEEKLY_COMMITS }} | |
embed-color: 0xFF6600 | |
- name: Get Short Commit Hash | |
run: | | |
echo 'SHORT_COMMIT_HASH<<EOF' >> $GITHUB_ENV | |
git rev-parse --short HEAD >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Upload Build | |
uses: sinshutu/[email protected] | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
with: | |
args: ./build/libs/kontraption-* | |
- name: Send Embedded Discord Message to VS | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.VS_DISCORD_WEBHOOK }} | |
embed-title: "Kontraption Nightly from ${{ github.ref_name }}" | |
embed-description: | | |
Nightlies are posted every friday at 00:00 UTC | |
The nightly builds WILL have bugs and MIGHT be broken and not launch at all or corrupt your world! Use these builds with caution! | |
New commits: | |
${{ env.WEEKLY_COMMITS }} | |
embed-color: 0xFF6600 | |
- name: Upload Build to VS | |
uses: sinshutu/[email protected] | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.VS_DISCORD_WEBHOOK }} | |
with: | |
args: ./build/libs/kontraption-* |