@@ -47,32 +47,35 @@ jobs:
4747 steps :
4848 - name : Verify branch
4949 run : |
50- if [ "${{ github.ref } }" != "refs/heads/main" ]; then
50+ if [ "${GITHUB_REF }" != "refs/heads/main" ]; then
5151 echo "❌ Error: Releases can only be triggered from main branch"
52- echo "Current ref: ${{ github.ref } }"
52+ echo "Current ref: ${GITHUB_REF }"
5353 exit 1
5454 fi
5555
5656 - name : Confirm major release
5757 if : ${{ inputs.version == 'major' || inputs.version == 'premajor' }}
5858 run : |
59- if [ "${{ inputs.confirm_major } }" != "RELEASE MAJOR" ]; then
59+ if [ "${INPUTS_CONFIRM_MAJOR }" != "RELEASE MAJOR" ]; then
6060 echo "❌ For major/premajor releases, set confirm_major to RELEASE MAJOR"
6161 exit 1
6262 fi
63+ env :
64+ INPUTS_CONFIRM_MAJOR : ${{ inputs.confirm_major }}
6365
6466 - name : Checkout repository
6567 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
6668 with :
6769 fetch-depth : 0
6870 token : ${{ secrets.GH_ACCESS_TOKEN }}
71+ persist-credentials : false
6972
7073 - name : Install uv and set Python version
7174 uses : astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
7275 with :
7376 version : " 0.11.2"
7477 python-version : " 3.12"
75- enable-cache : true
78+ enable-cache : false
7679
7780 - name : Configure Git
7881 env :
@@ -94,10 +97,10 @@ jobs:
9497 - name : Calculate new version
9598 id : new-version
9699 run : |
97- current_version="${{ steps.current-version.outputs.version } }"
98- version_type="${{ inputs.version } }"
99- prerelease_type="${{ inputs.prerelease_type } }"
100- prerelease_increment="${{ inputs.prerelease_increment } }"
100+ current_version="${STEPS_CURRENT_VERSION_OUTPUTS_VERSION }"
101+ version_type="${INPUTS_VERSION }"
102+ prerelease_type="${INPUTS_PRERELEASE_TYPE }"
103+ prerelease_increment="${INPUTS_PRERELEASE_INCREMENT }"
101104
102105 # Extract base version (strip any pre-release suffix like a1, b2, rc1)
103106 base_version=$(echo "$current_version" | sed -E 's/(a|b|rc)[0-9]+$//')
@@ -195,31 +198,42 @@ jobs:
195198 echo "version=$new_version" >> $GITHUB_OUTPUT
196199 echo "is_prerelease=$is_prerelease" >> $GITHUB_OUTPUT
197200 echo "New version: $new_version (prerelease: $is_prerelease)"
201+ env :
202+ STEPS_CURRENT_VERSION_OUTPUTS_VERSION : ${{ steps.current-version.outputs.version }}
203+ INPUTS_VERSION : ${{ inputs.version }}
204+ INPUTS_PRERELEASE_TYPE : ${{ inputs.prerelease_type }}
205+ INPUTS_PRERELEASE_INCREMENT : ${{ inputs.prerelease_increment }}
198206
199207 - name : Check if tag already exists
200208 run : |
201- if git rev-parse "v${{ steps.new-version.outputs.version } }" >/dev/null 2>&1; then
202- echo "❌ Error: Tag v${{ steps.new-version.outputs.version } } already exists"
209+ if git rev-parse "v${STEPS_NEW_VERSION_OUTPUTS_VERSION }" >/dev/null 2>&1; then
210+ echo "❌ Error: Tag v${STEPS_NEW_VERSION_OUTPUTS_VERSION } already exists"
203211 exit 1
204212 fi
205- echo "✅ Tag v${{ steps.new-version.outputs.version }} does not exist"
213+ echo "✅ Tag v${STEPS_NEW_VERSION_OUTPUTS_VERSION} does not exist"
214+ env :
215+ STEPS_NEW_VERSION_OUTPUTS_VERSION : ${{ steps.new-version.outputs.version }}
206216
207217 - name : Update version in pyproject.toml
208218 run : |
209- uv version ${{ steps.new-version.outputs.version }}
219+ uv version ${STEPS_NEW_VERSION_OUTPUTS_VERSION}
220+ env :
221+ STEPS_NEW_VERSION_OUTPUTS_VERSION : ${{ steps.new-version.outputs.version }}
210222
211223 - name : Verify version consistency
212224 run : |
213225 pyproject_version=$(uv version --short)
214226
215227 echo "pyproject.toml version: $pyproject_version"
216228
217- if [ "$pyproject_version" != "${{ steps.new-version.outputs.version } }" ]; then
229+ if [ "$pyproject_version" != "${STEPS_NEW_VERSION_OUTPUTS_VERSION }" ]; then
218230 echo "❌ Error: Version in files doesn't match expected version"
219231 exit 1
220232 fi
221233
222234 echo "✅ Versions are consistent: $pyproject_version"
235+ env :
236+ STEPS_NEW_VERSION_OUTPUTS_VERSION : ${{ steps.new-version.outputs.version }}
223237
224238 - name : Build package
225239 run : uv build --no-sources
@@ -250,14 +264,16 @@ jobs:
250264 ls -lh dist/
251265
252266 # Verify the version in the built artifacts matches
253- expected_version="${{ steps.new-version.outputs.version } }"
267+ expected_version="${STEPS_NEW_VERSION_OUTPUTS_VERSION }"
254268 wheel_file=$(ls dist/*.whl | head -1)
255269 if ! echo "$wheel_file" | grep -q "$expected_version"; then
256270 echo "❌ Error: Wheel filename doesn't contain expected version $expected_version"
257271 echo "Wheel file: $wheel_file"
258272 exit 1
259273 fi
260274 echo "✅ Artifact version verified"
275+ env :
276+ STEPS_NEW_VERSION_OUTPUTS_VERSION : ${{ steps.new-version.outputs.version }}
261277
262278 - name : Smoke test wheel
263279 run : |
@@ -270,32 +286,38 @@ jobs:
270286 - name : Commit version changes
271287 run : |
272288 git add pyproject.toml uv.lock
273- git commit -m "chore: release v${{ steps.new-version.outputs.version }}"
289+ git commit -m "chore: release v${STEPS_NEW_VERSION_OUTPUTS_VERSION}"
290+ env :
291+ STEPS_NEW_VERSION_OUTPUTS_VERSION : ${{ steps.new-version.outputs.version }}
274292
275293 - name : Create and push tag
276294 id : push-tag
277295 run : |
278- git tag "v${{ steps.new-version.outputs.version } }"
296+ git tag "v${STEPS_NEW_VERSION_OUTPUTS_VERSION }"
279297 git push origin main
280- git push origin "v${{ steps.new-version.outputs.version }}"
298+ git push origin "v${STEPS_NEW_VERSION_OUTPUTS_VERSION}"
299+ env :
300+ STEPS_NEW_VERSION_OUTPUTS_VERSION : ${{ steps.new-version.outputs.version }}
281301
282302 - name : Publish to PyPI
283303 id : publish-pypi
284304 run : uv publish --trusted-publishing always
285305
286306 - name : Create GitHub Release
287- id : create-release
288- uses : softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
289- with :
290- tag_name : v${{ steps.new-version.outputs.version }}
291- name : v${{ steps.new-version.outputs.version }}
292- generate_release_notes : true
293- prerelease : ${{ steps.new-version.outputs.is_prerelease == 'true' }}
294- files : |
295- dist/*.whl
296- dist/*.tar.gz
307+ run : |
308+ prerelease_flag=""
309+ if [ "${IS_PRERELEASE}" = "true" ]; then
310+ prerelease_flag="--prerelease"
311+ fi
312+ gh release create "v${VERSION}" \
313+ --title "v${VERSION}" \
314+ --generate-notes \
315+ $prerelease_flag \
316+ dist/*.whl dist/*. tar.gz
297317 env :
298- GITHUB_TOKEN : ${{ secrets.GH_ACCESS_TOKEN }}
318+ GH_TOKEN : ${{ secrets.GH_ACCESS_TOKEN }}
319+ VERSION : ${{ steps.new-version.outputs.version }}
320+ IS_PRERELEASE : ${{ steps.new-version.outputs.is_prerelease }}
299321
300322 - name : Notify Slack on success
301323 if : success()
0 commit comments