Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Note: We may want to rename this file at some point. However, if we rename the workflow file name,
# we have to also update the Trusted Publisher settings on PyPI.

name: Packaging and Publishing
name: CDK Publish

on:
push:
Expand All @@ -14,7 +14,12 @@ on:
workflow_dispatch:
inputs:
version:
description: "Note that this workflow is intended for prereleases. For public-facing stable releases, please use the GitHub Releases workflow instead: https://github.com/airbytehq/airbyte-python-cdk/blob/main/docs/RELEASES.md. If running this workflow from main or from a dev branch, please enter the desired version number here, for instance 1.2.3dev0 or 1.2.3rc1."
description: >
Note that this workflow is intended for prereleases. For public-facing stable releases,
please use the GitHub Releases workflow instead:
https://github.com/airbytehq/airbyte-python-cdk/blob/main/docs/RELEASES.md.
For prereleases, please leave the version blank to use the detected version. Alternatively,
you can override the dynamic versioning for special use cases.
required: false
publish_to_pypi:
description: "Publish to PyPI. If true, the workflow will publish to PyPI."
Expand All @@ -37,17 +42,30 @@ jobs:
name: Build Python Package
runs-on: ubuntu-24.04
steps:
- name: Detect Release Tag Version

- name: Checkout CDK Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Detect Prerelease Version using Dunamai
uses: mtkennerly/dunamai-action@v1
with:
args: --style pep440
env-var: DETECTED_VERSION

- name: Detect Release Tag Version from git ref ('${{ github.ref_name }}')
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "Overriding Dunamai detected version: '${{ env.DETECTED_VERSION || 'none' }}'"
# Extract the version from the git ref
DETECTED_VERSION=${{ github.ref_name }}
echo "Version ref set to '${DETECTED_VERSION}'"
# Remove the 'v' prefix if it exists
DETECTED_VERSION="${DETECTED_VERSION#v}"
echo "Setting version to '$DETECTED_VERSION'"
echo "Setting detected version to '$DETECTED_VERSION'"
echo "DETECTED_VERSION=${DETECTED_VERSION}" >> $GITHUB_ENV

- name: Validate and set VERSION from git ref ('${{ github.ref_name }}') and input (${{ github.event.inputs.version || 'none' }})
- name: Validate and set VERSION (detected='${{ env.DETECTED_VERSION }}', input='${{ github.event.inputs.version || 'none' }}')
id: set_version
run: |
INPUT_VERSION=${{ github.event.inputs.version }}
Expand Down Expand Up @@ -84,10 +102,6 @@ jobs:
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
fi

- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2
env:
# Pass in the evaluated version from the previous step
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ version = "0.0.0" # Version will be calculated dynamically.

[tool.poetry-dynamic-versioning]
enable = true
style = "pep440" # Ensures compatibility with PyPI

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
Expand Down
Loading