Skip to content

Modular logistics and supply chain operating system (LSOS)

fix discord announcement workflow

Ronald A. Richardsond2ab5b8a94b7
diff --git a/.github/workflows/discord-announcement.yml b/.github/workflows/discord-announcement.yml
index 33938fc3..3a0479e2 100644
--- a/.github/workflows/discord-announcement.yml
+++ b/.github/workflows/discord-announcement.yml
@@ -1,13 +1,16 @@
name: Discord Announcement
on:
+ # automatic announcement after the “Create Release” workflow finishes
workflow_run:
workflows: ["Create Release"]
types: [completed]
+
+ # manual resend / missed-release button
workflow_dispatch:
inputs:
tag:
- description: 'Release tag (e.g. v1.0.0)'
+ description: "Release tag to announce (e.g. v0.7.1)"
required: true
jobs:
@@ -15,31 +18,47 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Checkout code
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - name: Read release notes
- id: notes
- run: |
- body="$(cat RELEASE.md)"
- echo "::set-output name=message::$(echo "${body}" | base64 -w0)"
- - name: Get tag name
- id: tag
- run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- - name: Decode notes
- id: decode
- run: |
- echo "::set-output name=text::$(echo '${{ steps.notes.outputs.message }}' | base64 --decode)"
- - name: Send message to Discord
- uses: tsickert/[email protected]
- with:
- webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
- username: Fleetbase
- content: |
- @everyone
- 📦 **Fleetbase ${{ steps.tag.outputs.tag }} released!**
-
- ${{ steps.decode.outputs.text }}
-
- [View full notes on GitHub](https://github.com/fleetbase/fleetbase/releases/tag/${{ steps.tag.outputs.tag }})
\ No newline at end of file
+ # 1️⃣ Decide which tag we’re talking about
+ - name: Resolve tag name
+ id: vars
+ run: |
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
+ else
+ echo "tag=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT"
+ fi
+ echo "TAG is ${{ steps.vars.outputs.tag }}"
+
+ # 2️⃣ Check out the exact commit that tag points to
+ - name: Checkout release source
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ steps.vars.outputs.tag }}
+ fetch-depth: 1
+
+ # 3️⃣ Read RELEASE.md and base-64 encode so multiline text survives
+ - name: Read release notes
+ id: notes
+ run: |
+ body="$(cat RELEASE.md)"
+ echo "b64=$(echo "$body" | base64 -w0)" >> "$GITHUB_OUTPUT"
+
+ # 4️⃣ Decode for Discord
+ - name: Decode notes
+ id: decode
+ run: |
+ echo "text=$(echo '${{ steps.notes.outputs.b64 }}' | base64 --decode)" >> "$GITHUB_OUTPUT"
+
+ # 5️⃣ Send the message
+ - name: Send announcement to Discord
+ uses: tsickert/[email protected]
+ with:
+ webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
+ username: Fleetbase
+ content: |
+ @everyone
+ 📦 **Fleetbase ${{ steps.vars.outputs.tag }} released!**
+
+ ${{ steps.decode.outputs.text }}
+
+ <https://github.com/fleetbase/fleetbase/releases/tag/${{ steps.vars.outputs.tag }}>
\ No newline at end of file