mastodon-notify.yml

 1name: Announce Release on Fosstodon
 2
 3on:
 4  release:
 5    types: [published]
 6
 7jobs:
 8  post-to-fosstodon:
 9    if: github.event.release.prerelease == false
10    runs-on: ubuntu-latest
11    steps:
12      - name: Send Post to Fosstodon
13        env:
14          MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} 
15          MESSAGE: |
16            Release ${{ github.event.release.tag_name }} of Matcha is out!
17            Check it out! ${{ github.event.release.html_url }}
18        run: |
19          JSON_PAYLOAD=$(jq -n --arg status "$MESSAGE" '{status: $status}')
20          
21          curl -sS -X POST "https://fosstodon.org/api/v1/statuses" \
22            -H "Authorization: Bearer $MASTODON_ACCESS_TOKEN" \
23            -H "Content-Type: application/json" \
24            -d "$JSON_PAYLOAD"