-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This mostly follows the docs from https://github.com/pypa/packaging.python.org/blob/main/source/guides/github-actions-ci-cd-sample/publish-to-test-pypi.yml. All I need is someone from the open source support team to add GitHub as a publisher (https://docs.pypi.org/trusted-publishers/adding-a-publisher/) (https://www.internalfb.com/wiki/Open_Source/Launch_an_OSS_Project/Releasing/#pypi) and we should be good. Reviewed By: SonicField Differential Revision: D68024795 fbshipit-source-id: 76531a9e17d035a53407986604ebad37cd1e0b65
- Loading branch information
1 parent
39e2eb0
commit d4be4f4
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,6 +6,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
|
||
# This build configuration uses a matrix to build and test multiple Python versions. | ||
# Each version is actioned across on multiple operating systems (Ubuntu, Windows, macOS). | ||
|
@@ -120,3 +122,92 @@ jobs: | |
with: | ||
name: ${{ matrix.wheel }}.zip | ||
path: build/dist/*.whl | ||
|
||
publish-to-testpypi: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- cibuildwheel | ||
- deadsnakes | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/ft_utils | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download Python wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: List Python wheels | ||
run: ls -lR dist | ||
|
||
- name: Publish Python wheels | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
publish-to-pypi: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- cibuildwheel | ||
- deadsnakes | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/ft_utils | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download Python wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: List Python wheels | ||
run: ls -lR dist | ||
|
||
- name: Publish Python wheels | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- publish-to-pypi | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Download Python wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Sign Python wheels | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: ./dist/*.whl | ||
|
||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
"$GITHUB_REF_NAME" | ||
--repo "$GITHUB_REPOSITORY" | ||
--notes "" | ||
- name: Upload artifacts | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release upload | ||
"$GITHUB_REF_NAME" dist/** | ||
--repo "$GITHUB_REPOSITORY" |