Skip to content

Commit 2cfff60

Browse files
fix(workflow): correct version extraction and Git setup
Improved the GitHub Actions workflow for publishing to PyPI by: - Assigning an ID to the version extraction step - Configuring Git user details separately - Ensuring the main branch is checked out before updating the version This ensures accurate version management and prevents errors during CI.
1 parent 0bd3a43 commit 2cfff60

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/test-publish-pypi.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,20 @@ jobs:
4545
run: pip install hatch
4646

4747
- name: Extract Version from tag
48+
id: extract_version
4849
run: echo "PACKAGE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
4950

50-
- name: Update Package Version File
51+
- name: Configure Git
5152
run: |
52-
echo "$PACKAGE_VERSION" > .package-version
5353
git config --global user.name "GitHub Actions"
5454
git config --global user.email "actions@github.com"
55-
git branch --track main origin/main || true
56-
git checkout main
55+
56+
- name: Checkout Main Branch
57+
run: git checkout main
58+
59+
- name: Update Package Version File
60+
run: |
61+
echo "$PACKAGE_VERSION" > .package-version
5762
git add .package-version
5863
git commit -m "Update package version to PACKAGE_VERSION [skip ci]"
5964
git push origin main

0 commit comments

Comments
 (0)