Skip to content

Commit 6893fbf

Browse files
p0dejesh3pik
authored andcommitted
ci: create release/tag on release: commit
This simplifies release automation by removing the need to create a tag and run two CI workflows - one for commit and one for the tag. Instead, simply bump the version in `pyproject.toml` and commit with a message starting with `release:`. The CI workflow will read a version from `pyproject.toml`, build a package, and create a release and a tag on GitHub.
1 parent 7a350e5 commit 6893fbf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- v*.*.*
97

108
concurrency:
119
group: ci-${{ github.ref }}
@@ -57,7 +55,7 @@ jobs:
5755
runs-on: ubuntu-latest
5856
needs: test
5957
environment: release
60-
if: startsWith(github.ref, 'refs/tags/v')
58+
if: github.ref_name == 'main' && startsWith(github.event.head_commit.message, 'release:')
6159
permissions:
6260
attestations: write
6361
contents: write
@@ -72,11 +70,13 @@ jobs:
7270
key: venv-${{ hashFiles('poetry.lock') }}
7371
- run: poetry install
7472
- run: poetry build
73+
- run: echo "version=$(poetry version --short)" >> $GITHUB_OUTPUT
74+
id: version
7575
- uses: actions/attest-build-provenance@v1
7676
with:
7777
subject-path: dist/*
7878
- uses: pypa/gh-action-pypi-publish@release/v1
79-
- run: gh release create ${{ github.ref_name }} --generate-notes dist/*
79+
- run: gh release create ${{ steps.version.outputs.version }} --generate-notes dist/*
8080
env:
8181
GH_TOKEN: ${{ github.token }}
8282
- uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)