-
Notifications
You must be signed in to change notification settings - Fork 116
ci: publish Anton staging release candidates (ENG-1159) #298
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
549cf3e
ci: publish Anton staging release candidates to PyPI (ENG-1159)
pnewsam 4cdd4f6
ci: restore freeze-scoped staging alert policy in publish-staging notify
pnewsam 60b9e6d
ci: pin build to minted version to survive re-runs
pnewsam 66ae9c1
docs: document the staging rc stream and fix version source of truth
pnewsam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: Staging pre-release and publish to PyPI | ||
|
|
||
| # rc pre-release stream: on every push to staging, validate, cut a PEP 440 | ||
| # pre-release (2.YY.M.DD.SEQrcN), and publish it to PyPI so cowork-server staging | ||
| # consumes an immutable, versioned Anton artifact instead of a mutable git branch | ||
| # or a hand-pinned commit (ENG-1159). Resolvers ignore pre-releases unless a | ||
| # specifier names one, and PyPI's `info.version` (which the prod desktop updater | ||
| # reads) excludes them, so prod installs can never pick these up. | ||
| # | ||
| # The publish job MUST live in this top-level workflow — PyPI Trusted Publishing | ||
| # does not support reusable workflows and matches the OIDC claim on THIS | ||
| # filename. Register publish-staging.yml as a trusted publisher (environment | ||
| # `pypi`) at the anton-agent PyPI project's publishing settings. | ||
| # | ||
| # Anton has nothing to self-pin (it does not depend on itself), so — unlike | ||
| # cowork-server's staging publisher — this builds from a clean checkout of the | ||
| # tag and needs no version-pretend override: hatch-vcs derives the exact rc | ||
| # version straight from the tag, identical to the stable path in release.yml. | ||
| # | ||
| # No workflow-level `permissions:` block: only the release job needs | ||
| # `contents: write`; every other job declares its own, so the repo default | ||
| # (read) applies to the rest. | ||
| # | ||
| # run-tree-ok: PyPI Trusted Publishing binds to this top-level workflow file. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [staging] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: staging-prerelease-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| unit-tests: | ||
| permissions: | ||
| contents: read | ||
| uses: ./.github/workflows/tests.yml | ||
|
|
||
| release: | ||
| needs: unit-tests | ||
| # workflow_dispatch can be pointed at any ref; only staging mints rc tags. | ||
| if: github.ref == 'refs/heads/staging' | ||
| permissions: | ||
| contents: write # tag push + release creation | ||
| uses: mindsdb/github-actions/.github/workflows/calver-release.yml@main | ||
| with: | ||
| calver-major: "2" | ||
| prerelease: true | ||
| runs-on: ubuntu-latest | ||
|
|
||
| publish: | ||
| name: Build and publish pre-release to PyPI | ||
| needs: release | ||
| runs-on: ubuntu-latest | ||
| environment: pypi | ||
| permissions: | ||
| contents: read | ||
| id-token: write # required for trusted publisher (OIDC) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.release.outputs.tag }} | ||
| fetch-depth: 0 # hatch-vcs needs tags to derive version | ||
|
pnewsam marked this conversation as resolved.
|
||
|
|
||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Build package | ||
| run: uv build | ||
|
pnewsam marked this conversation as resolved.
|
||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| # Trusted publisher (OIDC) — publish-staging.yml must be registered at | ||
| # the anton-agent PyPI project's publishing settings (environment: pypi). | ||
|
|
||
| notify: | ||
| # Alert the eng channel if ANY job in the staging release/publish pipeline | ||
| # fails. | ||
| # One job covers both outcomes: a `uses:` job cannot branch on status, so | ||
| # the aggregate result picks the failed or recovered message, and a | ||
| # cancelled run stays silent. | ||
| needs: [unit-tests, release, publish] | ||
| if: ${{ github.ref == 'refs/heads/staging' && !cancelled() && !contains(needs.*.result, 'cancelled') }} | ||
| permissions: | ||
| contents: read | ||
| actions: read # the prior-run lookup behind the recovery message | ||
| uses: mindsdb/github-actions/.github/workflows/notify-main-failure.yml@main | ||
| with: | ||
| env-name: "staging prerelease" | ||
| status: ${{ contains(needs.*.result, 'failure') && 'failed' || 'recovered' }} | ||
|
pnewsam marked this conversation as resolved.
|
||
| # This publisher only ever runs on staging, so the alert is always | ||
| # freeze-scoped: reserve release-blocking escalation for the freeze | ||
| # window rather than paging the eng channel on every midweek failure. | ||
| # Preserves the policy the shared CI notify applied via | ||
| # `freeze-scoped: ${{ github.ref_name == 'staging' }}` before this | ||
| # pipeline took ownership of the alert. | ||
| freeze-scoped: true | ||
| runs-on: ubuntu-latest | ||
| secrets: inherit | ||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.