Skip to content

Commit b2c8f7f

Browse files
ci: restore workflow_dispatch trigger to pypi_publish.yml for prereleases (#1045)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 2170721 commit b2c8f7f

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/pypi_publish.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# Triggers:
44
# - release: published - When user clicks "Publish" on a draft release (downloads pre-built assets)
5+
# - workflow_dispatch - On-demand prerelease builds from a PR branch
56
#
67
# Authentication: This workflow expects GitHub OIDC for passwordless PyPI publishing.
78
# For more info: https://docs.pypi.org/trusted-publishers/
@@ -11,6 +12,21 @@ name: Publish Package
1112
on:
1213
release:
1314
types: [published]
15+
workflow_dispatch:
16+
inputs:
17+
git_ref:
18+
description: 'Git ref to build from (e.g., refs/pull/123/head)'
19+
type: string
20+
required: true
21+
version_override:
22+
description: 'Version string to publish (overrides dynamic versioning)'
23+
type: string
24+
required: true
25+
publish:
26+
description: 'Whether to publish to PyPI'
27+
type: string
28+
required: false
29+
default: 'true'
1430

1531
env:
1632
AIRBYTE_ANALYTICS_ID: ${{ vars.AIRBYTE_ANALYTICS_ID }}
@@ -26,13 +42,40 @@ jobs:
2642
name: PyPi
2743
url: https://pypi.org/p/airbyte
2844
steps:
45+
# For release events: download pre-built assets
2946
- name: Download release assets
47+
if: github.event_name == 'release'
3048
uses: robinraju/release-downloader@v1.12
3149
with:
3250
tag: ${{ github.event.release.tag_name }}
3351
fileName: "*"
3452
out-file-path: dist
3553

54+
# For workflow_dispatch (prereleases): checkout, override version, and build
55+
- name: Checkout code
56+
if: github.event_name == 'workflow_dispatch'
57+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
58+
with:
59+
ref: ${{ github.event.inputs.git_ref }}
60+
fetch-depth: 0
61+
persist-credentials: false
62+
63+
- name: Install uv
64+
if: github.event_name == 'workflow_dispatch'
65+
uses: astral-sh/setup-uv@f06b870e0a91d23284a3013acc55e6f88ab4b904 # v7
66+
with:
67+
enable-cache: false
68+
69+
- name: Build package with version override
70+
if: github.event_name == 'workflow_dispatch'
71+
run: |
72+
# Override dynamic versioning with the prerelease version
73+
export UV_DYNAMIC_VERSIONING_BYPASS="$VERSION_OVERRIDE"
74+
uv build
75+
env:
76+
VERSION_OVERRIDE: ${{ github.event.inputs.version_override }}
77+
3678
# Uses GitHub OIDC for passwordless authentication (see header comment)
3779
- name: Publish to PyPI
80+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
3881
uses: pypa/gh-action-pypi-publish@v1.13.0

0 commit comments

Comments
 (0)