11name : Deploy & Announce Release
22
33on :
4+ # Runs on pushes to the `main` branch
45 push :
56 branches : [main]
7+
8+ # Allow manual triggering from the Actions tab
69 workflow_dispatch :
710
11+ # Permissions needed for GitHub Pages deployment
812permissions :
913 contents : read
1014 pages : write
1115 id-token : write
1216
17+ # Prevent overlapping deploys
1318concurrency :
1419 group : pages
1520 cancel-in-progress : false
2126 - name : ☁️ Checkout repository
2227 uses : actions/checkout@v4
2328 with :
24- fetch-depth : 0
29+ fetch-depth : 0 # Needed for full commit history (e.g. for changelogs)
2530
2631 - name : 🔧 Setup pnpm
2732 uses : pnpm/action-setup@v3
@@ -46,20 +51,20 @@ jobs:
4651 - name : 🧱 Build docs
4752 run : pnpm docs:build
4853
49- - name : 🗄️ Upload pages artifact
54+ - name : 🗄️ Upload Pages artifact
5055 uses : actions/upload-pages-artifact@v3
5156 with :
5257 path : .vitepress/dist
5358
5459 deploy :
55- name : Deploy to GitHub Pages
60+ name : 🚀 Deploy to GitHub Pages
5661 needs : build
5762 runs-on : ubuntu-latest
5863 environment :
5964 name : github-pages
6065 url : ${{ steps.deployment.outputs.page_url }}
6166 steps :
62- - name : 🚀 Deploy to GitHub Pages
67+ - name : 🔄 Deploy to GitHub Pages
6368 id : deployment
6469 uses : actions/deploy-pages@v4
6570
@@ -68,36 +73,43 @@ jobs:
6873 needs : build
6974 runs-on : ubuntu-latest
7075 steps :
71- - name : 🔍 Fetch latest merged PR via API
76+ - name : 🔍 Fetch latest merged PR via GitHub API
7277 id : fetch_pr
7378 env :
7479 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7580 REPO : ${{ github.repository }}
7681 run : |
82+ # Fetch latest merged PR to main
7783 curl -s -H "Authorization: token $GH_TOKEN" \
7884 "https://api.github.com/repos/$REPO/pulls?state=closed&base=main&sort=updated&direction=desc&per_page=1" \
7985 -o pr.json
8086
87+ # Extract relevant fields
8188 PR_NUMBER=$(grep '"number":' pr.json | head -n 1 | awk '{print $2}' | tr -d ',')
8289 PR_TITLE=$(grep '"title":' pr.json | head -n 1 | cut -d ':' -f2- | sed 's/^ "//;s/",$//')
8390 PR_URL=$(grep '"html_url":' pr.json | head -n 1 | cut -d '"' -f4)
8491 sed -n '/"body":/,$p' pr.json | sed '1s/.*"body": "//; s/",$//' > pr_body.md
8592
93+ # Export to env
8694 echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
8795 echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
8896 echo "PR_URL=$PR_URL" >> $GITHUB_ENV
8997
90- - name : 📦 Extract released packages
98+ - name : 📦 Extract released packages from PR body
9199 id : extract
92100 run : |
93101 REPO="https://github.com/${{ github.repository }}"
102+
103+ # Extract lines starting with '## ' from PR body (i.e., package names)
94104 grep '^## ' pr_body.md | sed 's/^## //' > packages.txt
95105
106+ # Generate Telegram HTML links to each released package
96107 while read -r line; do
97108 ENCODED_TAG=$(printf "%s" "$line" | jq -sRr @uri)
98109 echo " • <a href=\"$REPO/releases/tag/$ENCODED_TAG\">$line</a>"
99110 done < packages.txt > release_links.html
100111
112+ # Export formatted list to env
101113 {
102114 echo "RELEASE_LINKS<<EOF"
103115 cat release_links.html
0 commit comments