Repository navigation
91 lines (85 loc) Β· 3.45 KB
/
Copy pathfinalize-deprecations.yml
File metadata and controls
91 lines (85 loc) Β· 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# .github/workflows/finalize-deprecations.yml
name: Finalize Deprecations
on:
push:
branches: [main]
paths: ['asterisk/supported-asterisk-builds.yml']
permissions:
contents: write
concurrency:
group: main-yaml-writer
cancel-in-progress: false
jobs:
finalize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- run: pip install -r requirements.txt
- name: Stamp deprecated_at on pending versions
id: finalize
run: |
OUT=$(python3 scripts/apply-tag-lifecycle.py --phase finalize)
echo "$OUT"
python3 scripts/update-readme-versions.py
# The script reports what it stamped as: finalized: ['21.12.2', '20.7-cert8']
DEPRECATED=$(echo "$OUT" | sed -n "s/^finalized: \[\(.*\)\]$/\1/p" | tr -d "'" | tr ',' ' ' | xargs)
echo "deprecated=$DEPRECATED" >> "$GITHUB_OUTPUT"
- name: Commit if changed
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add asterisk/supported-asterisk-builds.yml README.md
git commit -m "chore(deprecations): finalize deprecated_at on merge [skip ci]"
git pull --rebase origin main
git push
else
echo "Nothing pending to finalize."
fi
# Mirror of the release-announce timeline hook (announce-releases.yml):
# deprecations stamped in this run become an entry on the
# andrius.mobi/asterisk timeline. Runs after the commit so an entry is
# only sent for finalized state; failure here is loud, recovery is the
# blog's manual workflow_dispatch (asterisk-updates.yml).
- name: Update andrius.mobi/asterisk timeline
if: steps.finalize.outputs.deprecated != ''
env:
BLOG_DISPATCH_TOKEN: ${{ secrets.BLOG_DISPATCH_TOKEN }}
DEPRECATED: ${{ steps.finalize.outputs.deprecated }}
run: |
if [ -z "$BLOG_DISPATCH_TOKEN" ]; then
echo "::notice::BLOG_DISPATCH_TOKEN not set - skipping timeline update"
exit 0
fi
VERSION_LIST=$(echo "$DEPRECATED" | sed 's/ /, /g; s/, \([^,]*\)$/ and \1/')
TITLE="Deprecated: Asterisk $VERSION_LIST Debian images"
PAYLOAD=$(jq -n --arg title "$TITLE" '{
event_type: "asterisk-update",
client_payload: {
title: $title,
url: "https://github.com/andrius/asterisk",
tags: "docker,deprecated"
}
}')
curl -sfS -X POST \
-H "Authorization: Bearer $BLOG_DISPATCH_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/andrius/blog/dispatches \
-d "$PAYLOAD"
echo "Timeline entry sent: $TITLE"
# Telegram ping to the owner when an unattended run fails. Requires repo
# secret TELEGRAM_BOT_TOKEN + variable TELEGRAM_CHAT_ID; skips with a warning when unset.
notify-failure:
needs: [finalize]
if: failure()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/telegram-notify
with:
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
chat-id: ${{ vars.TELEGRAM_CHAT_ID }}