-
Notifications
You must be signed in to change notification settings - Fork 0
Move release onto py-canon #2
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
Open
soodoku
wants to merge
1
commit into
main
Choose a base branch
from
ci/release-on-py-canon
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 was deleted.
Oops, something went wrong.
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,69 @@ | ||
| name: Release | ||
|
|
||
| # py-canon's reusable-release, as calibre/simcheck/covered/preen use, replacing | ||
| # a bespoke `python-publish.yml`. | ||
| # | ||
| # **The PyPI trusted publisher for this project must be updated to name | ||
| # `release.yml`.** OIDC claims reference the workflow path, so publishing fails | ||
| # until that is changed on PyPI. | ||
| # | ||
| # Tests are not re-run here, by design: canon relies on CI having already run | ||
| # against the commit the tag points at. | ||
|
|
||
| on: | ||
| push: | ||
| tags: ["v*"] | ||
| workflow_dispatch: | ||
| inputs: | ||
| publish: | ||
| description: >- | ||
| Upload to PyPI. Only takes effect when the run is started from a tag; | ||
| from a branch this is a build-and-check rehearsal. | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # A manual run and a tag push can otherwise race for the same ref: two builds, | ||
| # and two `dist` artifacts uploaded under one name. | ||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| release: | ||
| uses: gojiplus/py-canon/.github/workflows/reusable-release.yml@v1 | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| with: | ||
| # `gh release create` fails when the release already exists, so create it | ||
| # only on the original tag push — not on a manual re-run of a released tag. | ||
| github-release: ${{ github.event_name == 'push' }} | ||
|
|
||
| # PyPI trusted publishing rejects reusable workflows (the OIDC claims | ||
| # must reference this repo's workflow file), so the publish step lives | ||
| # here rather than in py-canon's reusable-release. | ||
| publish: | ||
| needs: release | ||
| # The version is derived from the tag, so anything built off a branch is a dev | ||
| # version (1.0.post3.dev0+abc1234). A PyPI upload cannot be withdrawn, so never | ||
| # publish a non-tag build, and make a manual run opt in explicitly. | ||
| if: >- | ||
| startsWith(github.ref, 'refs/tags/') && | ||
| (github.event_name == 'push' || inputs.publish) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| environment: pypi | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - name: Publish (trusted publishing, PEP 740 attestations) | ||
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1 | ||
| with: | ||
| attestations: true | ||
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.
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.
When the release tag differs from
v0.2.0, this workflow still builds package version0.2.0:pyproject.tomldeclares a static version andsrc/streamcal/__init__.pyhard-codes the same value, with no VCS-based version configuration. For example, av0.3.0push would create a GitHub release containingstreamcal-0.2.0, and PyPI would reject that distribution if 0.2.0 is already published; configure dynamic tag-derived versioning or require and validate a matching static version before release.Useful? React with 👍 / 👎.