@@ -3,36 +3,30 @@ name: Announce fetch-kit Release
33on :
44 push :
55 tags :
6- - ' v*.*.*' # Triggers on semantic version tags
6+ - ' v*.*.*'
77
88jobs :
99 announce :
10- runs-on : ubuntu -latest
10+ runs-on : windows -latest
1111
1212 steps :
13- - name : Checkout repository
13+ - name : Checkout repo
1414 uses : actions/checkout@v3
1515
16- - name : Extract changelog for the tag
16+ - name : Extract changelog for tag
1717 id : changelog
18+ shell : pwsh
1819 run : |
19- TAG="${GITHUB_REF#refs/tags/}"
20- echo "Tag: $TAG"
21-
22- # Extract the changelog section for the given tag
23- LATEST_CHANGES=$(awk "/## $TAG/{flag=1; next}/## /{flag=0}flag" CHANGELOG.md)
24-
25- # Escape double quotes for JSON compatibility
26- LATEST_CHANGES=$(echo "$LATEST_CHANGES" | sed 's/"/\\"/g')
27-
28- # Save the changelog to an environment variable
29- echo "LATEST_CHANGES<<EOF" >> $GITHUB_ENV
30- echo "$LATEST_CHANGES" >> $GITHUB_ENV
31- echo "EOF" >> $GITHUB_ENV
20+ $TAG = "${{ github.ref_name }}" # tag pushed
21+ $TAG_NO_V = $TAG.TrimStart('v')
22+ $found = $false
3223
33- - name : Send Discord Webhook
34- run : |
35- curl -H "Content-Type: application/json" \
36- -X POST \
37- -d "{\"content\": \"📦 **New fetch-kit Release: $TAG**\nRepository: $GITHUB_REPOSITORY\n\`\`\`\n${LATEST_CHANGES}\n\`\`\`\"}" \
38- ${{ secrets.DISCORD_WEBHOOK }}
24+ $lines = Get-Content CHANGELOG.md | ForEach-Object {
25+ if ($_ -match "^##\s+$TAG" -or $_ -match "^##\s+$TAG_NO_V") {
26+ $found = $true
27+ return
28+ }
29+ if ($found -and $_ -match "^##\s+") {
30+ $found = $false
31+ }
32+ if ($found) { $_ }
0 commit comments