Skip to content

Notify Release

Notify Release #1

name: Notify Release
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: "Release tag to simulate"
required: true
jobs:
discord:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare env
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV"
else
echo "TAG=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
fi
echo "CHANGELOG_FILE=docs/changelogs/${TAG}.md" >> "$GITHUB_ENV"
- name: Read changelog
id: changelog
env:
FILE: ${{ env.CHANGELOG_FILE }}
run: |
if [[ -f "$FILE" ]]; then
echo "found=true" >> "$GITHUB_OUTPUT"
CONTENT="$(python - <<'PY'
import sys, urllib.parse
print(urllib.parse.quote(sys.stdin.read()))
PY
< "$FILE")"
echo "body=${CONTENT}" >> "$GITHUB_OUTPUT"
else
echo "found=false" >> "$GITHUB_OUTPUT"
echo "body=" >> "$GITHUB_OUTPUT"
fi
- name: Notify Discord
uses: rjstone/discord-webhook-notify@v2
with:
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_URL }}
username: TimeCopilot Releases
severity: info
title: "🚀 New release ${{ env.TAG }}"
description: "Changelog also available at https://timecopilot.dev/changelogs/${{ env.TAG }}/"
details: ${{ steps.changelog.outputs.body }}
processingOptions: percentDecode
footer: "pushed via GitHub Actions"