Skip to content

Announce Latest Nightly to Discord #1

Announce Latest Nightly to Discord

Announce Latest Nightly to Discord #1

name: Announce Latest Nightly to Discord
on:
workflow_call:
workflow_dispatch:
inputs:
diagnostic_mode:
description: Diagnostic Mode
type: boolean
default: false
required: true
jobs:
get-package-info:
name: Get Latest Package Info
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.download-info.outputs.version }}
jarFile: ${{ fromJson(steps.info.outputs.latestJson)[0].name }}
mcVersion: ${{steps.minecraft.outputs.prop}}
neoVersion: ${{steps.neoforge.outputs.prop}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Setup Groovy
uses: wtfjoke/setup-groovy@v2
with:
groovy-version: '4.x'
- name: Download Package Info
id: download-info
uses: compactmods/[email protected]
env:
GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
owner: compactmods
repo: compactmachines
group: dev.compactmods.compactmachines.compactmachines-neoforge
filter: "^compactmachines-neoforge-(?:[\\d\\.]+).jar$"
outputFile: compactmachines.json
- name: Debug output
run: |
echo "Version: ${{ steps.download-info.outputs.version }}"
cat compactmachines.json
- name: Read info into variable [latest]
id: info
run: echo "latestJson=$(cat compactmachines.json)" >> $GITHUB_OUTPUT
- name: Download JAR and prepare artifacts
run: |
mkdir release
curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name }}"
mv compactmachines.json release/compactmachines.json
- name: MC Version
id: minecraft
run: groovy read-manifest.groovy release/${{ fromJson(steps.info.outputs.latestJson)[0].name }} "Minecraft-Version" >> "$GITHUB_OUTPUT"
- name: NeoForge Version
id: neoforge
run: groovy read-manifest.groovy release/${{ fromJson(steps.info.outputs.latestJson)[0].name }} "NeoForge-Version" >> "$GITHUB_OUTPUT"
- name: Add Artifact
uses: actions/upload-artifact@v4
with:
name: release
path: release
announce:
name: Discord Announcement
needs: [ get-package-info ]
runs-on: ubuntu-22.04
steps:
- name: Grab JAR and Info
uses: actions/download-artifact@v4
with:
name: release
path: .
- name: Announce Timestamp
id: timestamp
run: echo "buildTimestamp=$(date --iso-8601=seconds)" >> $GITHUB_OUTPUT
- name: Announce Release
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}
avatar-url: "https://compactmods.dev/personal-shrinking-device.png"
content: "**New Version Available: Compact Machines v${{ needs.get-package-info.outputs.version }}**"
filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name }}
embed-title: "**Mod File Information**"
embed-description: "Filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}}"
embed-url: "https://www.curseforge.com/minecraft/mc-mods/compact-machines"
embed-thumbnail-url: "https://media.forgecdn.net/avatars/thumbnails/10/602/64/64/635460270800375500.png"
embed-timestamp: ${{ steps.timestamp.outputs.buildTimestamp }}