Skip to content

Commit 02b9b2a

Browse files
authored
Update pypi-publish.yml
1 parent 8206eca commit 02b9b2a

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,59 @@
11
name: Publish package to PyPi
22

33
on:
4-
# CHANGED: This allows you to manually run the workflow from the
5-
# GitHub Actions tab (click 'Run workflow').
4+
# This allows you to manually run the workflow from the GitHub Actions tab.
65
workflow_dispatch:
76
inputs:
87
branch:
98
description: 'Branch or tag to build from (e.g., main or v1.0.0)'
109
required: true
1110
default: 'main'
11+
release_title:
12+
description: 'Release Title (e.g., v1.0.0: Initial Release)'
13+
required: true # Making title required for a proper release
14+
# Removed release_notes input here
1215

1316
jobs:
1417
push:
1518
runs-on: ubuntu-latest
1619

17-
# 1. SECURITY: Add permissions for OIDC token generation
20+
# UPDATED: Permissions now include 'releases: write'
1821
permissions:
19-
id-token: write # Grants permission to exchange a token with PyPI
20-
contents: read # Allows checkout of the repository
22+
id-token: write
23+
contents: read
24+
releases: write # <-- REQUIRED for creating the GitHub Release
2125

2226
steps:
2327
- name: Checkout
2428
uses: actions/checkout@v5
2529
with:
26-
# Use the branch/tag provided in the manual input
2730
ref: ${{ github.event.inputs.branch }}
2831

2932
- name: Setup Python
3033
uses: actions/setup-python@v5
3134
with:
32-
# Use a stable, specific version
3335
python-version: 3.11
3436

3537
- name: Build package
36-
# Install the 'build' tool and then run it to create the sdist and wheel.
3738
run: |
3839
python -m pip install --upgrade pip
3940
python -m pip install build
4041
python -m build
4142
42-
# 2. SECURITY: Publish to PyPi (using Trusted Publisher)
43+
# 2. Publish to PyPi (using Trusted Publisher)
4344
- name: Publish to PyPi (using Trusted Publisher)
4445
uses: pypa/gh-action-pypi-publish@release/v1
45-
# No manual secrets are needed!
46+
47+
# 3. ADDED: Create GitHub Release
48+
- name: Create GitHub Release
49+
id: create_release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: ${{ github.event.inputs.branch }}
55+
release_name: ${{ github.event.inputs.release_title }}
56+
# The body now uses the title since release_notes was removed
57+
body: ${{ github.event.inputs.release_title }}
58+
draft: false
59+
prerelease: false

0 commit comments

Comments
 (0)