diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml new file mode 100644 index 0000000..d78ea0b --- /dev/null +++ b/.github/workflows/create-release.yaml @@ -0,0 +1,44 @@ +name: Create Release + +on: + # Trigger on pushes after running this for past releases + # push: + # tags: + # - "*" # Match any tag + workflow_dispatch: # Manual trigger for release creation + inputs: + tag: + description: "The tag to create a release for" + required: true + +jobs: + create-release: + name: Create GitHub Release + runs-on: ubuntu-latest + environment: release # Link to the protected environment + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract Release Notes + id: extract_notes + run: | + VERSION=${{ github.event.inputs.tag }} + sed -n "/## \\[$VERSION\\]/,/## \\[/p" CHANGELOG.md | sed '$d' | sed "s/## \\[$VERSION\\]/## $VERSION/" > RELEASE_NOTES.md + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.event.inputs.tag }} + release_name: Release ${{ github.event.inputs.tag }} + body_path: ./RELEASE_NOTES.md + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Output release URL + run: | + echo "Release URL: ${{ steps.create_release.outputs.html_url }}"