Skip to content

Commit c640e65

Browse files
committed
feat(ci): update publish workflow to trigger on push to main
- Change trigger from release to push on main branch - Add steps to get version from pyproject.toml and create a release - Include changelog link in release body
1 parent 853a421 commit c640e65

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
11
name: Publish to PyPI
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
branches: [main]
66

77
jobs:
88
publish:
99
runs-on: ubuntu-latest
1010

1111
steps:
1212
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
1315

1416
- name: Set up Python
1517
uses: actions/setup-python@v5
1618
with:
1719
python-version: '3.11'
1820

21+
- name: Get version from pyproject.toml
22+
id: get_version
23+
run: |
24+
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
25+
echo "version=v$VERSION" >> $GITHUB_OUTPUT
26+
27+
- name: Create Release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ steps.get_version.outputs.version }}
34+
release_name: Release ${{ steps.get_version.outputs.version }}
35+
body: |
36+
## What's Changed
37+
${{ github.event.head_commit.message }}
38+
39+
**Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ steps.get_version.outputs.version }}
40+
draft: false
41+
prerelease: false
42+
1943
- name: Install build dependencies
2044
run: |
2145
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)