Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1551,34 +1551,3 @@ jobs:
send_files "${chat}" || { echo "::error::files ${chat}: $(cat /tmp/tg_doc.json)"; fail=1; }
done
exit "${fail}"

# The public post: the banner with the caption, nothing else. Only for a
# release that was published, since the post links to its page.
- name: Announce on the channel
if: ${{ always() && (inputs.release || 'publish') == 'publish' && needs.publish.result == 'success' }}
continue-on-error: true
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_CHANNEL_BOT_TOKEN || secrets.TELEGRAM_BOT_TOKEN }}
CHANNEL: ${{ vars.TELEGRAM_CHANNEL }}
run: |
set -uo pipefail
if [ -z "${CHANNEL}" ] || [ -z "${TELEGRAM_BOT_TOKEN}" ]; then
echo "::notice title=Channel post skipped::Set the TELEGRAM_CHANNEL variable (for example @sozoapp) and make the bot an admin of that channel."
exit 0
fi
if [ ! -s caption.html ]; then
echo "::warning title=Channel post skipped::No caption was built."
exit 0
fi
API="https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}"
if [ -s banner.png ]; then
curl -sS --fail-with-body -X POST "${API}/sendPhoto" -F "chat_id=${CHANNEL}" \
-F "photo=@banner.png" -F "caption=<caption.html" -F "parse_mode=HTML" \
-o /tmp/tg_channel.json && { echo "Posted to ${CHANNEL}"; exit 0; }
echo "::warning::sendPhoto ${CHANNEL}: $(cat /tmp/tg_channel.json) — posting the text alone"
fi
curl -sS --fail-with-body -X POST "${API}/sendMessage" \
--data-urlencode "chat_id=${CHANNEL}" --data-urlencode "text=$(cat caption.html)" \
--data "parse_mode=HTML" --data "disable_web_page_preview=true" -o /tmp/tg_channel.json \
&& echo "Posted to ${CHANNEL} without the banner" \
|| echo "::error title=Channel post failed::$(cat /tmp/tg_channel.json)"
Loading