Skip to content

Commit f0aab19

Browse files
authored
ci: enable github release creation and update permissions in publish workflow (#257)
**Added:** - Add step to create a GitHub release with autogenerated notes if release does not exist, using the `gh` CLI in the publish workflow **Changed:** - Update workflow permissions from `contents: read` to `contents: write` to allow release creation
1 parent c742048 commit f0aab19

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/publish.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Build and Publish
1111
environment: protected
1212
permissions:
13-
contents: read
13+
contents: write
1414
id-token: write
1515
runs-on: ubuntu-latest
1616
steps:
@@ -38,3 +38,13 @@ jobs:
3838

3939
- name: Publish to PyPI
4040
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
41+
42+
- name: Create GitHub Release
43+
run: |
44+
if ! gh release view ${{ github.ref_name }} &>/dev/null; then
45+
gh release create ${{ github.ref_name }} --generate-notes
46+
else
47+
echo "Release already exists, skipping creation"
48+
fi
49+
env:
50+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)