-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.75 KB
/
Copy pathpypi-publish.yml
File metadata and controls
59 lines (51 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Publish package to PyPi
on:
# This allows you to manually run the workflow from the GitHub Actions tab.
workflow_dispatch:
inputs:
branch:
description: 'Branch or tag to build from (e.g., main or v1.0.0)'
required: true
default: 'main'
release_title:
description: 'Release Title (e.g., v1.0.0: Initial Release)'
required: true # Making title required for a proper release
# Removed release_notes input here
jobs:
push:
runs-on: ubuntu-latest
# UPDATED: Permissions now include 'releases: write'
permissions:
id-token: write
contents: read
releases: write # <-- REQUIRED for creating the GitHub Release
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.event.inputs.branch }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Build package
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build
# 2. Publish to PyPi (using Trusted Publisher)
- name: Publish to PyPi (using Trusted Publisher)
uses: pypa/gh-action-pypi-publish@release/v1
# 3. ADDED: Create GitHub Release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.branch }}
release_name: ${{ github.event.inputs.release_title }}
# The body now uses the title since release_notes was removed
body: ${{ github.event.inputs.release_title }}
draft: false
prerelease: false