Skip to content

Commit 31bc99a

Browse files
committed
Update workflow to release correct version
1 parent 54060c5 commit 31bc99a

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.github/workflows/publish_release.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
with:
2828
name: python-package-distributions
2929
path: dist/
30+
- name: Get version for github release
31+
run: python get_version
32+
- name: Store the version
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: version.semver
36+
path: ./
3037

3138
publish-to-testpypi:
3239
name: Publish Python 🐍 distribution 📦 to TestPyPI
@@ -76,14 +83,17 @@ jobs:
7683
inputs: >-
7784
./dist/*.tar.gz
7885
./dist/*.whl
86+
- name: Get version for release
87+
uses: actions/download-artifact@v4
88+
with:
89+
name: version.semver
90+
path: ./
7991
- name: Create GitHub Release
8092
env:
8193
GITHUB_TOKEN: ${{ github.token }}
82-
run: >-
83-
gh release create
84-
'${{ github.ref_name }}'
85-
--repo '${{ github.repository }}'
86-
--notes ""
94+
run: |
95+
VERSION=$(cat ./version.semver)
96+
gh release create $VERSION --repo '${{ github.repository }}' --notes ""
8797
- name: Upload artifact signatures to GitHub Release
8898
env:
8999
GITHUB_TOKEN: ${{ github.token }}
@@ -92,5 +102,5 @@ jobs:
92102
# sigstore-produced signatures and certificates.
93103
run: >-
94104
gh release upload
95-
'${{ github.ref_name }}' dist/**
105+
$VERSION dist/**
96106
--repo '${{ github.repository }}'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Project specific
2-
2+
*.semver
33

44
# Byte-compiled / optimized / DLL files
55
__pycache__/

get_version.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from src import example_package_samuelhomberg
2+
with open("version.semver", "w") as f:
3+
f.write(example_package_samuelhomberg.__version__)

0 commit comments

Comments
 (0)