chore(release): version packages #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Announce fetch-kit Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| announce: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Announce to Discord | |
| run: | | |
| # Get the tag that triggered the workflow | |
| TAG=${GITHUB_REF#refs/tags/} # e.g., v4.0.6 | |
| VERSION=${TAG#v} # remove leading 'v' to match CHANGELOG.md headers | |
| # Extract the changelog block under that version until the next '##' | |
| LATEST=$(sed -n "/^## $VERSION$/,/^## /{ /^## /!p }" CHANGELOG.md) | |
| # If nothing found, fallback | |
| if [ -z "$LATEST" ]; then | |
| LATEST="(no changelog entry found for $VERSION)" | |
| fi | |
| # Escape JSON special characters | |
| LATEST_ESC=$(echo "$LATEST" | sed 's/\\/\\\\/g; s/"/\\"/g') | |
| # Send Discord message | |
| curl -sS -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d "{\"content\": \"📦 **New fetch-kit Release: $TAG**\nRepository: $GITHUB_REPOSITORY\n\`\`\`\n$LATEST_ESC\n\`\`\`\"}" \ | |
| ${{ secrets.DISCORD_WEBHOOK }} |