-
Notifications
You must be signed in to change notification settings - Fork 428
Add PyPI Publishing to Automated Release #4220
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
adnanhemani
wants to merge
14
commits into
apache:main
Choose a base branch
from
adnanhemani:ahemani/add_pypi_publishing_to_automated_release
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.
+252
−21
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9c73901
Add PyPI Publishing to Automated Release
adnanhemani e58cf72
Add PyPI Publishing to Automated Release
adnanhemani 68aa6dd
remove fork guard
adnanhemani d69c708
fix spurrious change
adnanhemani 4e76f71
fix up for PR
adnanhemani 2d2e7bf
refactor
adnanhemani e0c7bcf
fork changes
adnanhemani 2a5d327
zizmor and bug fix
adnanhemani 2eba4bc
updating to allowlisted action version
adnanhemani 893be43
revert testing changes
adnanhemani 0bcd755
review comments
adnanhemani ee7b105
Update Makefile
adnanhemani 116e0f7
Upload Python Wheel file to SVN, Use SVN to upload to PyPI
adnanhemani 0d0812d
ensure both wheel and source files are uploaded
adnanhemani 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
Some comments aren't visible on the classic Files Changed page.
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
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 |
|---|---|---|
|
|
@@ -523,10 +523,126 @@ jobs: | |
| | Artifact Hub metadata | ✅ Committed to dist dev | | ||
| EOT | ||
|
|
||
| publish-python-client-rc: | ||
| name: Publish Python Client RC to PyPI | ||
| runs-on: ubuntu-latest | ||
| needs: [prerequisite-checks] | ||
| permissions: | ||
| contents: read | ||
| # IMPORTANT: this permission is mandatory for Trusted Publishing to PyPI | ||
| id-token: write | ||
|
Member
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. Same here, deserves a comment.
Contributor
Author
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. Done. |
||
| env: | ||
| DRY_RUN: ${{ needs.prerequisite-checks.outputs.dry_run }} | ||
| version_without_rc: ${{ needs.prerequisite-checks.outputs.version_without_rc }} | ||
| rc_number: ${{ needs.prerequisite-checks.outputs.rc_number }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up environment variables | ||
| run: | | ||
| echo "RELEASEY_DIR=$(pwd)/releasey" >> $GITHUB_ENV | ||
| echo "LIBS_DIR=$(pwd)/releasey/libs" >> $GITHUB_ENV | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| - name: Set up JDK for openapi-generator-cli | ||
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '21' | ||
|
|
||
| - name: Install Subversion | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y subversion | ||
|
|
||
| - name: Import GPG key | ||
| uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 | ||
| with: | ||
| gpg_private_key: ${{ secrets.POLARIS_GPG_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] | ||
| git_user_signingkey: true | ||
| git_commit_gpgsign: true | ||
|
|
||
| - name: Build Python client RC | ||
| run: | | ||
| make client-rc-build RC_VERSION="${version_without_rc}" RC_NUMBER="${rc_number}" | ||
|
|
||
| - name: Sign and checksum Python distributions | ||
| run: | | ||
| source "${LIBS_DIR}/_exec.sh" | ||
|
|
||
| for dist_file in client/python/dist/*.whl client/python/dist/*.tar.gz; do | ||
| calculate_sha512 "${dist_file}" | ||
| exec_process gpg --armor --output "${dist_file}.asc" --detach-sig "${dist_file}" | ||
| done | ||
|
|
||
| - name: Publish Python client RC to Test PyPI | ||
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | ||
| with: | ||
| repository-url: https://test.pypi.org/legacy/ | ||
| packages-dir: client/python/dist/ | ||
|
|
||
| - name: Stage Python wheel to Apache dist dev repository | ||
| env: | ||
| SVN_USERNAME: ${{ secrets.POLARIS_SVN_DEV_USERNAME }} # zizmor: ignore[secrets-outside-env] | ||
| SVN_PASSWORD: ${{ secrets.POLARIS_SVN_DEV_PASSWORD }} # zizmor: ignore[secrets-outside-env] | ||
| run: | | ||
| echo "::add-mask::$SVN_PASSWORD" | ||
|
|
||
| source "${LIBS_DIR}/_constants.sh" | ||
| source "${LIBS_DIR}/_exec.sh" | ||
|
|
||
| dist_dev_dir=${RELEASEY_DIR}/polaris-dist-dev | ||
|
|
||
| # Retry logic for SVN checkout (Apache SVN can have transient connectivity issues) | ||
| exec_process_with_retries 5 60 "${dist_dev_dir}" svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${APACHE_DIST_URL}${APACHE_DIST_PATH}" "${dist_dev_dir}" | ||
|
|
||
| python_client_version_dir="${dist_dev_dir}/python-client/${version_without_rc}" | ||
|
|
||
| # If the python-client version directory already exists in SVN (e.g. re-running the workflow), | ||
| # delete it so we can re-add fresh artifacts without "already versioned" errors. | ||
| if svn info "${python_client_version_dir}" &>/dev/null 2>&1; then | ||
| exec_process svn delete "${python_client_version_dir}" | ||
| fi | ||
|
|
||
| exec_process mkdir -p "${python_client_version_dir}" | ||
| exec_process cp client/python/dist/* "${python_client_version_dir}/" | ||
|
|
||
| exec_process cd "${dist_dev_dir}" | ||
| exec_process svn add --parents "python-client/${version_without_rc}" | ||
|
|
||
| exec_process svn commit --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive -m "Stage Apache Polaris Python client ${version_without_rc} RC${rc_number}" | ||
|
|
||
| - name: Update step summary | ||
| run: | | ||
| echo "## Python Client RC" >> $GITHUB_STEP_SUMMARY | ||
| cat <<EOT >> $GITHUB_STEP_SUMMARY | ||
| 🎉 Python client RC published successfully: | ||
|
|
||
| | Property | Value | | ||
| | --- | --- | | ||
| | Version | \`${version_without_rc}rc${rc_number}\` | | ||
| | Registry | Test PyPI | | ||
| | Apache dist dev | \`python-client/${version_without_rc}\` | | ||
| EOT | ||
|
|
||
| generate-release-email: | ||
| name: Generate Release Email Body | ||
| runs-on: ubuntu-latest | ||
| needs: [prerequisite-checks, build-and-publish-artifacts, build-docker, build-and-stage-helm-chart] | ||
| needs: | ||
| - prerequisite-checks | ||
| - build-and-publish-artifacts | ||
| - build-docker | ||
| - build-and-stage-helm-chart | ||
| - publish-python-client-rc | ||
| permissions: | ||
| contents: read | ||
| env: | ||
|
|
@@ -581,6 +697,12 @@ jobs: | |
|
|
||
| NB: you have to build the Docker images locally in order to test Helm charts. | ||
|
|
||
| The Python CLI RC wheel is available on: | ||
| * https://dist.apache.org/repos/dist/dev/polaris/python-client/${version_without_rc} | ||
|
|
||
| The Python CLI RC is also available on Test PyPI: | ||
| * https://test.pypi.org/project/apache-polaris/${version_without_rc}rc${rc_number}/ | ||
|
|
||
| You can find the KEYS file here: | ||
| * https://downloads.apache.org/polaris/KEYS | ||
|
|
||
|
|
||
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.
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.
This permission isn't commonly known, please add a comment explaining what it's used for.
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.
Done!