Skip to content

Commit a5c878a

Browse files
committed
read version from git tag and replace inside of pyproject.toml
1 parent 4211305 commit a5c878a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/cd.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ jobs:
2626
TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///')
2727
# Extract the path of the module to publish from the tag
2828
PACKAGE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev)
29-
# Save the path to the module for use in the build/publish step to only update the module associated with this tag
29+
# Extract version to publish from tag
30+
VERSION="${TAG_NO_PREFIX##*/}"
31+
echo $VERSION
32+
# Save the path to the module and the version for use in the build/publish step to only update the module associated with this tag
3033
echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV
34+
echo "VERSION=$VERSION" >> $GITHUB_ENV
3135
- name: Build & Publish to PyPi
3236
run: |
3337
pip install poetry
34-
cd $PACKAGE_PATH
38+
cd $PACKAGE_PATH
39+
# replace version
40+
sed -i "s/^version =.*/version = \"${VERSION}\"/" pyproject.toml
3541
poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}"

0 commit comments

Comments
 (0)