Skip to content

Commit 8774c13

Browse files
committed
ci: run semantic-release directly with GitPython pinned
GitPython 3.1.60 removed Actor.name_email_regex, which crashes python-semantic-release's config load, and the PSR GitHub action installs its dependencies unpinned at image build time, so every Release dispatch now fails (upstream: python-semantic-release/python-semantic-release#1476). Replace the action step with a direct, version-pinned PSR invocation in a venv (whose python also provides the pip the configured build_command bootstraps uv with). Restore the action once a fixed PSR release is out. By Digitl
1 parent 759fe5e commit 8774c13

1 file changed

Lines changed: 34 additions & 17 deletions

File tree

‎.github/workflows/release.yaml‎

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,27 +78,44 @@ jobs:
7878
- name: Pytest
7979
run: uv run pytest
8080

81+
# Runs PSR directly instead of python-semantic-release/python-semantic-release@v10:
82+
# the action installs its dependencies unpinned at image build, and GitPython
83+
# 3.1.60 removed Actor.name_email_regex, which crashes PSR's config load
84+
# (python-semantic-release/python-semantic-release#1476). Restore the action
85+
# once a PSR release ships the fix. The venv python provides the pip that the
86+
# configured build_command bootstraps uv with.
8187
- name: Release
8288
id: release
83-
uses: python-semantic-release/python-semantic-release@v10
84-
with:
85-
prerelease: ${{ inputs.release_type == 'release-candidate' }}
86-
prerelease_token: rc
89+
env:
90+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
91+
run: |
92+
/usr/bin/python3 -m venv "$RUNNER_TEMP/psr"
93+
"$RUNNER_TEMP/psr/bin/pip" install --quiet "python-semantic-release==10.6.1" "gitpython==3.1.59"
94+
export PATH="$RUNNER_TEMP/psr/bin:$PATH"
95+
96+
git config user.name "Semantic Release"
97+
git config user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
98+
99+
flags=(--commit --tag --vcs-release --prerelease-token rc)
100+
if [ "${{ inputs.release_type }}" = "release-candidate" ]; then
101+
flags+=(--as-prerelease --no-changelog)
102+
else
103+
flags+=(--changelog)
104+
fi
87105
# Force a bump level when the commit history alone wouldn't trigger a
88-
# release (only chore/refactor since the last tag). Empty = let PSR
106+
# release (only chore/refactor since the last tag). "auto" = let PSR
89107
# decide from the Conventional Commits, the normal path.
90-
force: ${{ inputs.force != 'auto' && inputs.force || '' }}
91-
# Runs the configured build_command (`uv lock`) so the release
92-
# commit carries a lock file consistent with the stamped versions.
93-
# The actual package build happens in the publish step below.
94-
build: true
95-
changelog: ${{ inputs.release_type == 'stable' }}
96-
commit: true
97-
tag: true
98-
vcs_release: true
99-
github_token: ${{ steps.app-token.outputs.token }}
100-
git_committer_email: "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
101-
git_committer_name: "Semantic Release"
108+
if [ "${{ inputs.force }}" != "auto" ]; then
109+
flags+=(--${{ inputs.force }})
110+
fi
111+
112+
before=$(git rev-parse HEAD)
113+
semantic-release -v version "${flags[@]}"
114+
if [ "$(git rev-parse HEAD)" != "$before" ]; then
115+
echo "released=true" >> "$GITHUB_OUTPUT"
116+
else
117+
echo "released=false" >> "$GITHUB_OUTPUT"
118+
fi
102119
103120
- name: Build & Publish
104121
if: steps.release.outputs.released == 'true'

0 commit comments

Comments
 (0)