-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[infra] add testpypi nightly build (#1601)
Closes #872 This PR adds the ability to run and publish pypi artifacts nightly to testpypi. It will publish as `pyiceberg` with new version under `0.9.0.dev${TIMESTAMP}`, i.e. `0.9.0.dev20250206050843`, adhering to PEP440 conversion. Here's a [test run on my fork](https://github.com/kevinjqliu/iceberg-python/actions/runs/13172235318) which published to https://test.pypi.org/project/pyiceberg-kevinliu/ This requires setting up [Publishing to PyPI with a Trusted Publisher](https://docs.pypi.org/trusted-publishers/) on https://test.pypi.org/ and using example of publishing [pyiceberg_core](https://github.com/apache/iceberg-rust/blob/8714ffd69c411990a89e1c3f03b51c33670f18ec/.github/workflows/release_python.yml#L120-L146) to testpypi Note, this PR also refactors `.github/workflows/python-release.yml`, i've [ran the workflow on my fork](https://github.com/kevinjqliu/iceberg-python/actions/runs/13172075517) and manually verified the version for both pypi and svn artifacts. Setup trusted publisher on testpypi for apache/iceberg-python repo https://test.pypi.org/manage/project/pyiceberg/settings/publishing/
- Loading branch information
1 parent
4d648bb
commit b47af2d
Showing
4 changed files
with
92 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
name: "Nightly PyPI Build" | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # Runs at midnight UTC every day | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
jobs: | ||
set-version: | ||
if: github.repository == 'apache/iceberg-python' # Only run for apache repo | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.set-version.outputs.VERSION }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install Poetry | ||
run: make install-poetry | ||
|
||
- name: Set version | ||
id: set-version | ||
run: | | ||
CURRENT_VERSION=$(poetry version --short) | ||
TIMESTAMP=$(date +%Y%m%d%H%M%S) | ||
echo "VERSION=${CURRENT_VERSION}.dev${TIMESTAMP}" >> "$GITHUB_OUTPUT" | ||
- name: Debug version | ||
run: echo "Publishing version ${{ steps.set-version.outputs.VERSION }}" | ||
|
||
nightly-build: | ||
needs: set-version | ||
uses: ./.github/workflows/pypi-build-artifacts.yml | ||
with: | ||
version: ${{ needs.set-version.outputs.VERSION }} | ||
testpypi-publish: | ||
name: Publish to TestPypi | ||
needs: | ||
- nightly-build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/pyiceberg | ||
|
||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- name: Download all the artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
merge-multiple: true | ||
path: dist/ | ||
- name: List downloaded artifacts | ||
run: ls -R dist/ | ||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true | ||
verbose: true |
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
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
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