-
-
Notifications
You must be signed in to change notification settings - Fork 22
Add a workflow to release and sign wheels #22
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 9 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e18f13a
Add workflow to release and sign wheels
agriyakhetarpal cf9845e
Move condition to PyPI publishing step
agriyakhetarpal 918e372
Merge branch 'main' into add-pypi-workflow
agriyakhetarpal 2deb188
Permanent GHA Attestations, update dependencies
agriyakhetarpal cd48f0c
Add a comment about the `twine` optional dep
agriyakhetarpal fb443f3
Rename from `cd.yaml` to `cd.yml`
agriyakhetarpal debaeea
Add a section on build provenance and verifying it
agriyakhetarpal f5424ee
Make the `push_to_pypi:` input explicit
agriyakhetarpal 55bdcc9
Move condition for PyPI trigger to the job
agriyakhetarpal b808dfa
Merge branch 'main' into add-pypi-workflow
agriyakhetarpal e6cde54
Add GitHub job summary for inspecting built wheels
agriyakhetarpal 57118e8
Temporarily trigger on pull requests
agriyakhetarpal 3018f12
Raise an error if no artifacts to upload
agriyakhetarpal cdfa62f
Temporarily allow triggering manually via fork
agriyakhetarpal cad440f
Temporarily disable commands
agriyakhetarpal 1bbd3d2
Fix `pdm` invocation
agriyakhetarpal 8340fa1
`pdm` is a build-time dependency, not a run-time one
agriyakhetarpal 68b5352
Fix summary printing
agriyakhetarpal 5f8a524
Clean up changes and add a sanity check
agriyakhetarpal aeb4bd6
Merge main
agriyakhetarpal 843ca7c
Add new architectures
agriyakhetarpal 6f65deb
Update descriptions
agriyakhetarpal 75620c3
Fix permissions hierarchy
agriyakhetarpal 6e0884a
Use uv to run script
agriyakhetarpal 1e0e6ac
Guard against shell injection
agriyakhetarpal c4d4df1
Bump GitHub Actions dependencies
agriyakhetarpal 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,89 @@ | ||
| name: CD | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Version to build Zig wheels for" | ||
| required: true | ||
| default: "latest" | ||
| suffix: | ||
| description: > | ||
| Suffix to append to the version in the wheel filename. This is useful for dev versions and version specifiers | ||
| required: false | ||
| default: "" | ||
| platforms: | ||
| description: > | ||
| Comma-separated values of platforms to build wheels for | ||
| required: false | ||
| default: "x86_64-windows,x86-windows,x86_64-macos,aarch64-macos,i386-linux,x86-linux,x86_64-linux,aarch64-linux,armv7a-linux,powerpc64le-linux" | ||
| push_to_pypi: | ||
| description: > | ||
| Whether to push the built wheels to PyPI. Can be 'true' or 'false', defaults to 'false'. | ||
| required: true | ||
| default: "false" | ||
|
|
||
| jobs: | ||
| build_wheels: | ||
| name: Build wheels | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
| - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | ||
| with: | ||
| python-version: "3.x" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install . | ||
|
|
||
| - name: Build wheels for all requested platforms | ||
| shell: bash | ||
| run: | | ||
| platforms=${{ github.event.inputs.platforms }} | ||
| IFS=',' read -r -a platform_array <<< "$platforms" | ||
| for platform in "${platform_array[@]}"; do | ||
| python make_wheels.py \ | ||
| --version ${{ github.event.inputs.version }} \ | ||
| --suffix ${{ github.event.inputs.suffix }} \ | ||
| --platform "$platform" | ||
| done | ||
|
|
||
| - name: Upload wheel artifacts | ||
| uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | ||
| with: | ||
| name: zig_wheels | ||
| path: dist/*.whl | ||
|
|
||
| deploy_wheels: | ||
| name: Deploy wheels | ||
| needs: [build_wheels] | ||
| if: >- | ||
| github.event.inputs.push_to_pypi == 'true' && | ||
| github.repository == 'ziglang/zig-pypi' | ||
| environment: pypi | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write # for OIDC trusted publishing | ||
| attestations: write # for the GitHub Actions Attestations feature | ||
| contents: read | ||
| steps: | ||
| - name: Download all wheel artifacts | ||
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
| with: | ||
| path: dist/ | ||
| merge-multiple: true | ||
|
|
||
| - name: Generate artifact attestations | ||
| uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 | ||
| with: | ||
| subject-path: dist/* | ||
|
|
||
| # This will publish the list of wheels inputted to the action to PyPI (set to | ||
| # off, by default). | ||
| # The workflow may be triggered multiple times with the `push_to_pypi` input | ||
| # set to 'true' to publish the wheels for any configurable version (non-dev). | ||
| - name: Publish wheels to PyPI | ||
| uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.10.2 | ||
| with: | ||
| packages-dir: dist/ | ||
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
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.