Skip to content

Commit 25bea26

Browse files
authored
Merge pull request #21 from code-with-amirhossein/amir78729-patch-22
Update deploy.yml
2 parents 6e1b817 + 13f96ef commit 25bea26

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,38 @@ jobs:
7676
uses: actions/deploy-pages@v4
7777

7878

79-
announcement:
80-
name: 📣 Announcement
79+
telegram-announcement:
80+
name: 📣 Announcement on Telegram
8181
needs: build
82-
uses: ./.github/workflows/announcement.yml
83-
with:
84-
pr_title: ${{ github.event.head_commit.message }}
85-
pr_number: ${{ needs.changesets.outputs.pr }}
86-
pr_url:
87-
https://github.com/${{ github.repository }}/pull/${{
88-
needs.changesets.outputs.pr }}
89-
pr_body: |
90-
${{ github.event.head_commit.message }}
91-
secrets:
92-
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
93-
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: 📦 Extract released packages
85+
id: extract
86+
run: |
87+
REPO="https://github.com/${{ github.repository }}"
88+
echo "${{ github.event.pull_request.body }}" > pr_body.md
89+
# Extract all lines starting with '## '
90+
grep '^## ' pr_body.md | sed 's/^## //' > packages.txt
91+
# Generate HTML list of links to releases
92+
while read -r line; do
93+
ENCODED_TAG=$(echo "$line" | jq -sRr @uri) # encode the tag for URL safety
94+
echo " • <a href=\"$REPO/releases/tag/$ENCODED_TAG\">$line</a>"
95+
done < packages.txt > release_links.html
96+
{
97+
echo "RELEASE_LINKS<<EOF"
98+
cat release_links.html
99+
echo "EOF"
100+
} >> "$GITHUB_ENV"
101+
102+
- name: 💬 Send Telegram Message
103+
uses: appleboy/telegram-action@master
104+
with:
105+
to: ${{ secrets.TELEGRAM_TO }}
106+
token: ${{ secrets.TELEGRAM_TOKEN }}
107+
format: html
108+
message: |
109+
🚀 <b><a href="https://github.com/${{ github.repository }}">${{ github.repository }}</a></b> was just released!
110+
${{ env.RELEASE_LINKS }}
111+
112+
🔗 PR: <a href="${{ github.event.pull_request.html_url }}"><b>${{ github.event.pull_request.title }}</b>#${{ github.event.pull_request.number }}</a>
94113

0 commit comments

Comments
 (0)