-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check if version has changed, to avoid error.
- Loading branch information
Showing
2 changed files
with
18 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,24 @@ jobs: | |
- name: Build package | ||
run: poetry build | ||
|
||
- name: Check version change | ||
id: check_version | ||
run: | | ||
git fetch origin main | ||
# Extract version from current pyproject.toml | ||
current_version=$(poetry version -s) | ||
# Extract version from main branch pyproject.toml | ||
main_version=$(git show origin/main:pyproject.toml | grep "^version = " | cut -d'"' -f2) | ||
if [ "$current_version" != "$main_version" ]; then | ||
echo "Version changed from $main_version to $current_version" | ||
echo "version_changed=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "Version unchanged" | ||
echo "version_changed=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Publish to PyPI | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_version.outputs.version_changed == 'true' | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters