-
Notifications
You must be signed in to change notification settings - Fork 666
chore: final touches #1770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: final touches #1770
Changes from all commits
da6982f
175600b
fea7e8b
a73e7aa
5c6ac61
b175492
4c46f82
c5ed34b
e5e3381
1607fb0
bb8e299
6ce36f2
2f0374b
e61da2a
571bbbc
4366186
32d2bcb
fcac141
83d2cdf
a2d1e76
edcc52e
19fa340
4e7981c
01c0dd4
27c435d
31a7bea
db46601
2f977db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| name: Publish harnesses | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Existing tag to release (e.g. harnesses-v0.1.1)' | ||
| required: true | ||
| type: string | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - "harnesses-v*" | ||
|
|
||
| jobs: | ||
| auto-tag-on-main: | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| outputs: | ||
| created: ${{ steps.tag.outputs.created }} | ||
| tag: ${{ steps.tag.outputs.tag }} | ||
| version: ${{ steps.tag.outputs.version }} | ||
| steps: | ||
| - name: Checkout main | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Create release tag for untagged version | ||
| id: tag | ||
| run: | | ||
| echo "created=false" >> "$GITHUB_OUTPUT" | ||
|
|
||
| VERSION=$(python - <<'PY' | ||
| import tomllib | ||
| from pathlib import Path | ||
| import sys | ||
|
|
||
| data = tomllib.loads(Path("packages/harnesses/pyproject.toml").read_text()) | ||
| version = data.get("project", {}).get("version") | ||
| if not version: | ||
| sys.exit("Could not find [project].version in packages/harnesses/pyproject.toml") | ||
| print(version) | ||
| PY | ||
| ) | ||
|
|
||
| TAG="harnesses-v${VERSION}" | ||
|
|
||
| if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then | ||
| echo "Tag ${TAG} already exists locally; skipping." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then | ||
| echo "Tag ${TAG} already exists on origin; skipping." | ||
| exit 0 | ||
| fi | ||
|
|
||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git tag -a "$TAG" -m "Release $TAG" | ||
| git push origin "$TAG" | ||
|
|
||
| echo "created=true" >> "$GITHUB_OUTPUT" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
||
| build-from-auto-tag: | ||
| needs: auto-tag-on-main | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.auto-tag-on-main.outputs.created == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| tag: ${{ needs.auto-tag-on-main.outputs.tag }} | ||
| version: ${{ needs.auto-tag-on-main.outputs.version }} | ||
| steps: | ||
| - name: Checkout auto-created tag | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: refs/tags/${{ needs.auto-tag-on-main.outputs.tag }} | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 | ||
|
|
||
| - name: Build harnesses | ||
| run: uv build packages/harnesses | ||
|
|
||
| - name: Upload dist artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: harnesses-dist | ||
| path: packages/harnesses/dist/ | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
|
|
||
| publish-from-auto-tag: | ||
| needs: build-from-auto-tag | ||
| runs-on: ubuntu-latest | ||
| environment: pypi-prod | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download dist artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: harnesses-dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate PyPI publish on releaseMedium Severity When Additional Locations (2)Triggered by project rule: BugBot Instructions Reviewed by Cursor Bugbot for commit 2f977db. Configure here. |
||
|
|
||
| build-tag: | ||
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/harnesses-v') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| tag: ${{ steps.release.outputs.tag }} | ||
| version: ${{ steps.release.outputs.version }} | ||
| steps: | ||
| - name: Checkout tagged release (dispatch) | ||
| if: github.event_name == 'workflow_dispatch' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: refs/tags/${{ inputs.tag }} | ||
|
|
||
| - name: Checkout tagged release (push) | ||
| if: github.event_name != 'workflow_dispatch' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Resolve release tag | ||
| id: release | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| PUSHED_REF: ${{ github.ref_name }} | ||
| INPUT_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || '' }} | ||
| run: | | ||
| if [ "$EVENT_NAME" = "workflow_dispatch" ]; then | ||
| TAG="$INPUT_TAG" | ||
| else | ||
| TAG="$PUSHED_REF" | ||
| fi | ||
|
|
||
| case "$TAG" in | ||
| harnesses-v*) ;; | ||
| *) | ||
| echo "Release tags must be prefixed with 'harnesses-v' (received '$TAG')" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| VERSION="${TAG#harnesses-v}" | ||
| FILE_VERSION=$(python - <<'PY' | ||
| import tomllib | ||
| from pathlib import Path | ||
| import sys | ||
|
|
||
| data = tomllib.loads(Path("packages/harnesses/pyproject.toml").read_text()) | ||
| version = data.get("project", {}).get("version") | ||
| if not version: | ||
| sys.exit("Could not find [project].version in packages/harnesses/pyproject.toml") | ||
| print(version) | ||
| PY | ||
| ) | ||
|
|
||
| if [ "$FILE_VERSION" != "$VERSION" ]; then | ||
| echo "Version mismatch: tag requests '$VERSION' but packages/harnesses/pyproject.toml defines '$FILE_VERSION'" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 | ||
|
|
||
| - name: Build harnesses | ||
| run: uv build packages/harnesses | ||
|
|
||
| - name: Upload dist artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: harnesses-dist | ||
| path: packages/harnesses/dist/ | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
|
|
||
| publish-tag: | ||
| needs: build-tag | ||
| runs-on: ubuntu-latest | ||
| environment: pypi-prod | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download dist artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: harnesses-dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Low
workflows/publish-harnesses.yml:12The
pushevent includes atagsfilter forharnesses-v*(lines 13-14), so whenauto-tag-on-mainpushes a new tag (line 65), the tag push triggers a second workflow run. That second run executesbuild-tag→publish-tagand attempts to upload the same version to PyPI again, which fails with a 409 Conflict because PyPI rejects duplicate uploads. Consider removing thetagsfilter from thepushevent so tag pushes do not start a redundant run.🚀 Reply "fix it for me" or copy this AI Prompt for your agent: