Skip to content

Commit 7ba3c62

Browse files
committed
Add GitHub Release creation step to publish-pypi workflow
1 parent 3499caf commit 7ba3c62

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@ on:
22
workflow_dispatch:
33
inputs:
44
publish_version:
5+
description: 'Version to publish (e.g., 2.6.5)'
56
required: true
67
type: string
8+
publish_to_real_pypi:
9+
description: 'Actually publish to the real PyPI (not just test site)?'
10+
required: true
11+
type: boolean
12+
default: false
713

814
jobs:
915
log-the-inputs:
1016
runs-on: ubuntu-latest
1117
steps:
1218
- run: |
1319
echo "target version: ${{ github.event.inputs.publish_version }}"
20+
echo "publish to real pypi: ${{ github.event.inputs.publish_to_real_pypi }}"
1421
env:
1522
VERSION: ${{ github.event.inputs.publish_version }}
1623
17-
upload-to-pypi:
18-
name: Publish to PyPI test site
24+
build-and-publish:
25+
name: Build and Publish
1926
runs-on: ubuntu-latest
2027
steps:
2128
- name: Dump GitHub context
@@ -86,10 +93,22 @@ jobs:
8693
attestations: false
8794

8895
- name: Publish to PyPI
96+
if: github.event.inputs.publish_to_real_pypi == 'true'
8997
uses: pypa/gh-action-pypi-publish@release/v1
9098
with:
9199
password: ${{ secrets.PYPI_API }}
92100
repository_url: https://upload.pypi.org/legacy/
93101
attestations: false
94102

103+
- name: Create GitHub Release
104+
if: github.event.inputs.publish_to_real_pypi == 'true'
105+
uses: softprops/action-gh-release@v1
106+
with:
107+
tag_name: v${{ github.event.inputs.publish_version }}
108+
name: Release Version ${{ github.event.inputs.publish_version }}
109+
files: dist/*
110+
generate_release_notes: true
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
95114

0 commit comments

Comments
 (0)