release.yml 952 B

12345678910111213141516171819202122232425262728293031323334
  1. name: Release
  2. on:
  3. push:
  4. tags: ["v*"]
  5. permissions:
  6. contents: write
  7. jobs:
  8. create-release:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v4
  12. - name: Extract version from tag
  13. id: version
  14. run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
  15. - name: Extract changelog section
  16. id: changelog
  17. run: |
  18. VERSION="${{ steps.version.outputs.version }}"
  19. # Extract the section for this version from CHANGELOG.md
  20. awk "/^## ${VERSION}$/,/^## [0-9]/" CHANGELOG.md | head -n -1 | tail -n +2 > /tmp/release-notes.md
  21. echo "notes<<EOF" >> "$GITHUB_OUTPUT"
  22. cat /tmp/release-notes.md >> "$GITHUB_OUTPUT"
  23. echo "EOF" >> "$GITHUB_OUTPUT"
  24. - name: Create GitHub Release
  25. uses: softprops/action-gh-release@v2
  26. with:
  27. body: ${{ steps.changelog.outputs.notes }}
  28. generate_release_notes: false