|
| 1 | +name: Announce Latest Nightly to Discord |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + diagnostic_mode: |
| 7 | + description: Diagnostic Mode |
| 8 | + type: boolean |
| 9 | + default: false |
| 10 | + required: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + vars: |
| 14 | + name: Get Variables |
| 15 | + runs-on: ubuntu-22.04 |
| 16 | + outputs: |
| 17 | + mcVersion: ${{steps.gradle_props.outputs.minecraft_version}} |
| 18 | + forgeVersion: ${{steps.gradle_props.outputs.forge_version}} |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Read MC and Forge versions |
| 27 | + id: gradle_props |
| 28 | + uses: christian-draeger/[email protected] |
| 29 | + with: |
| 30 | + path: "gradle.properties" |
| 31 | + properties: "minecraft_version forge_version" |
| 32 | + |
| 33 | + get-package-info: |
| 34 | + name: Get Latest Package Info |
| 35 | + runs-on: ubuntu-22.04 |
| 36 | + outputs: |
| 37 | + version: ${{ steps.download-info.outputs.version }} |
| 38 | + steps: |
| 39 | + - name: Download Package Info |
| 40 | + id: download-info |
| 41 | + uses: compactmods/[email protected] |
| 42 | + env: |
| 43 | + GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + with: |
| 45 | + owner: compactmods |
| 46 | + repo: compactmachines |
| 47 | + group: dev.compactmods.compactmachines |
| 48 | + filter: "^compactmachines-(?:[\\d\\.]{4})\.jar$" |
| 49 | + outputFile: compactmachines-nightly.json |
| 50 | + |
| 51 | + - name: Debug output |
| 52 | + run: | |
| 53 | + echo "Version: ${{ steps.download-info.outputs.version }}" |
| 54 | + cat compactmachines-nightly.json |
| 55 | +
|
| 56 | + - name: Read info into variable [latest] |
| 57 | + id: info |
| 58 | + run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT |
| 59 | + |
| 60 | + - name: Download JAR and prepare artifacts |
| 61 | + run: | |
| 62 | + mkdir release |
| 63 | + curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}" |
| 64 | + mv compactmachines-nightly.json release/compactmachines-nightly.json |
| 65 | +
|
| 66 | + - name: Add Artifact |
| 67 | + uses: actions/upload-artifact@v3 |
| 68 | + with: |
| 69 | + name: release |
| 70 | + path: release |
| 71 | + |
| 72 | + announce: |
| 73 | + name: Discord Announcement |
| 74 | + needs: [ vars, get-package-info ] |
| 75 | + runs-on: ubuntu-22.04 |
| 76 | + steps: |
| 77 | + - name: Grab JAR and Info |
| 78 | + uses: actions/download-artifact@v3 |
| 79 | + with: |
| 80 | + name: release |
| 81 | + path: . |
| 82 | + |
| 83 | + - name: Read info into variable [latest] |
| 84 | + id: info |
| 85 | + run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT |
| 86 | + |
| 87 | + - name: Announce Release |
| 88 | + uses: compactmods/[email protected] |
| 89 | + env: |
| 90 | + DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} |
| 91 | + with: |
| 92 | + filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}} |
| 93 | + channel: ${{ secrets.NIGHTLY_CHANNEL_ID }} |
| 94 | + modName: Compact Machines |
| 95 | + modVersion: ${{ needs.get-package-info.outputs.version }} |
| 96 | + thumbnail: https://media.forgecdn.net/avatars/10/602/635460270800375500.png |
| 97 | + |
| 98 | + forgeVersion: ${{ needs.vars.outputs.forgeVersion }} |
| 99 | + mcVersion: ${{ needs.vars.outputs.mcVersion }} |
0 commit comments