Skip to content

Commit 9fce373

Browse files
mldangeloclaude
andcommitted
fix: checkout release tag in build job and add manual re-publish trigger
Root cause of 0.1.3 not publishing to PyPI: the build job used actions/checkout@v6 without a ref, so it checked out GITHUB_SHA (the triggering commit) rather than the release tag. When the release-please action tags a release during an earlier push, the build job can check out a commit where pyproject.toml still has the old version, causing a version mismatch and build failure. Fixes: - Build job now checks out the release tag ref explicitly, ensuring pyproject.toml always matches the tagged version - Derive expected version from the tag name instead of the release-please version output (more reliable) - Add workflow_dispatch with a tag input so failed releases can be re-published without needing a new commit: run the workflow manually with tag=promptfoo-v0.1.3 to re-trigger build+publish - Run unit tests in the build job before publishing (was just an import check before) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ecd2226 commit 9fce373

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

.github/workflows/release-please.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
branches:
1111
- main
1212
workflow_dispatch:
13+
inputs:
14+
tag:
15+
description: "Release tag to re-publish (e.g. promptfoo-v0.1.3). Use when a release build failed."
16+
required: true
17+
type: string
1318

1419
jobs:
1520
release-please:
@@ -19,22 +24,27 @@ jobs:
1924
pull-requests: write
2025
outputs:
2126
release_created: ${{ steps.release.outputs.release_created }}
22-
tag_name: ${{ steps.release.outputs.tag_name }}
23-
version: ${{ steps.release.outputs.version }}
27+
tag_name: ${{ inputs.tag || steps.release.outputs.tag_name }}
2428
steps:
29+
# Only run the bot on push events; skip it for manual re-publish triggers.
2530
- uses: googleapis/release-please-action@v4
2631
id: release
32+
if: github.event_name == 'push'
2733
with:
2834
token: ${{ secrets.GITHUB_TOKEN }}
2935

3036
build:
31-
if: needs.release-please.outputs.release_created == 'true'
32-
runs-on: ubuntu-latest
37+
if: |
38+
inputs.tag != '' ||
39+
needs.release-please.outputs.release_created == 'true'
3340
needs: release-please
41+
runs-on: ubuntu-latest
3442
permissions:
3543
contents: read
3644
steps:
3745
- uses: actions/checkout@v6
46+
with:
47+
ref: ${{ needs.release-please.outputs.tag_name }}
3848

3949
- uses: astral-sh/setup-uv@v7
4050
with:
@@ -46,22 +56,22 @@ jobs:
4656
- name: Install dependencies
4757
run: uv sync --extra dev
4858

49-
- name: Run tests
50-
run: |
51-
# Quick smoke test before publishing
52-
uv run python -c "import promptfoo; print(promptfoo.__version__)"
59+
- name: Run unit tests
60+
run: uv run pytest -m 'not smoke' -q
5361

5462
- name: Build package
5563
run: uv build
5664

57-
- name: Verify package version matches release
65+
- name: Verify package version matches release tag
66+
env:
67+
TAG: ${{ needs.release-please.outputs.tag_name }}
5868
run: |
59-
EXPECTED_VERSION="${{ needs.release-please.outputs.version }}"
69+
EXPECTED_VERSION="${TAG#promptfoo-v}"
6070
if ls dist/*-${EXPECTED_VERSION}-*.whl 1> /dev/null 2>&1; then
61-
echo "✓ Package version ${EXPECTED_VERSION} matches release"
71+
echo "✓ Package version ${EXPECTED_VERSION} matches release tag ${TAG}"
6272
else
6373
echo "ERROR: Package version mismatch!"
64-
echo "Expected version: ${EXPECTED_VERSION}"
74+
echo "Expected: ${EXPECTED_VERSION} (from tag: ${TAG})"
6575
echo "Built packages:"
6676
ls -la dist/
6777
exit 1
@@ -74,7 +84,9 @@ jobs:
7484
path: dist/
7585

7686
publish-pypi:
77-
if: needs.release-please.outputs.release_created == 'true'
87+
if: |
88+
inputs.tag != '' ||
89+
needs.release-please.outputs.release_created == 'true'
7890
needs: [build, release-please]
7991
runs-on: ubuntu-latest
8092
environment:

0 commit comments

Comments
 (0)