Skip to content

Commit

Permalink
Update version from git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
dalager committed Oct 9, 2024
1 parent 3eaa94b commit f25fa73
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ jobs:
with:
python-version: "3.x"

- name: Ensure tag is v-prefixed
id: check_tag
run: |
if [[ "${{ github.ref }}" != refs/tags/v* ]]; then
echo "Error: Release tag must be v-prefixed (e.g., v1.0.0)."
exit 1
fi
- name: Extract version from release tag
id: get_version
run: |
echo "Release tag: ${{ github.ref }}"
VERSION="${{ github.ref#refs/tags/v }}"
echo "Version: $VERSION"
echo "release_version=$VERSION" >> $GITHUB_ENV
- name: Update version in pyproject.toml
run: |
sed -i "s/^version = .*/version = \"${{ env.release_version }}\"/" pyproject.toml
- name: Build release distributions
run: |
python -m pip install build
Expand Down

0 comments on commit f25fa73

Please sign in to comment.