Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .github/pr-welcome-community.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ As needed or by request, Airbyte Maintainers can execute the following slash com
- `/fix-pr` - Fixes most formatting and linting issues
- `/poetry-lock` - Updates poetry.lock file
- `/test-pr` - Runs tests with the updated PyAirbyte
- `/prerelease` - Builds and publishes a prerelease version to TestPyPI

### Community Support

Expand Down
1 change: 1 addition & 0 deletions .github/pr-welcome-internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Airbyte Maintainers can execute the following slash commands on your PR:
- `/fix-pr` - Fixes most formatting and linting issues
- `/poetry-lock` - Updates poetry.lock file
- `/test-pr` - Runs tests with the updated PyAirbyte
- `/prerelease` - Builds and publishes a prerelease version to TestPyPI

### Community Support

Expand Down
184 changes: 184 additions & 0 deletions .github/workflows/prerelease-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
name: On-Demand Prerelease

on:
workflow_dispatch:
inputs:
pr:
description: 'PR Number'
type: string
required: true
comment-id:
description: 'Comment ID (Optional)'
type: string
required: false

env:
AIRBYTE_ANALYTICS_ID: ${{ vars.AIRBYTE_ANALYTICS_ID }}

permissions:
contents: read
pull-requests: write
issues: write
id-token: write # Required for trusted publishing to TestPyPI

jobs:
start-workflow:
name: Start Workflow
runs-on: ubuntu-latest
steps:
- name: Resolve workflow variables
id: vars
uses: aaronsteers/resolve-ci-vars-action@2e56afab0344bbe03c047dfa39bae559d0291472 # v0.1.6

- name: Append comment with job run link
id: first-comment-action
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ github.event.inputs.comment-id }}
issue-number: ${{ github.event.inputs.pr }}
body: |
> **Prerelease Build Started**
>
> Building prerelease package from this PR...
> [Check job output.](${{ steps.vars.outputs.run-url }})

outputs:
source-repo: ${{ steps.vars.outputs.pr-source-repo-name-full }}
source-branch: ${{ steps.vars.outputs.pr-source-git-branch }}
commit-sha: ${{ steps.vars.outputs.pr-source-git-sha }}
pr-number: ${{ steps.vars.outputs.pr-number }}
job-run-url: ${{ steps.vars.outputs.run-url }}
first-comment-id: ${{ steps.first-comment-action.outputs.comment-id }}

build-prerelease:
name: Build Prerelease Package
needs: [start-workflow]
runs-on: ubuntu-latest
steps:
- name: Authenticate as GitHub App
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
id: get-app-token
with:
owner: "airbytehq"
repositories: "PyAirbyte"
app-id: ${{ secrets.OCTAVIA_BOT_APP_ID }}
private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}

- name: Checkout PR
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ needs.start-workflow.outputs.commit-sha }}
fetch-depth: 0 # Required for poetry-dynamic-versioning

- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.10'

- name: Install build tools
run: |
pip install poetry poetry-dynamic-versioning

- name: Get version info
id: version
run: |
# Get the version that poetry-dynamic-versioning will generate
VERSION=$(poetry version -s 2>/dev/null || echo "unknown")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Generated version: $VERSION"

- name: Build package
uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0

outputs:
version: ${{ steps.version.outputs.version }}

publish-to-testpypi:
name: Publish to TestPyPI
needs: [start-workflow, build-prerelease]
runs-on: ubuntu-latest
environment:
name: TestPyPi
url: https://test.pypi.org/p/airbyte
steps:
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: Packages
path: dist

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: https://test.pypi.org/legacy/
continue-on-error: true
id: testpypi-publish

outputs:
testpypi-success: ${{ steps.testpypi-publish.outcome == 'success' }}

post-success-comment:
name: Post Success Comment
needs: [start-workflow, build-prerelease, publish-to-testpypi]
runs-on: ubuntu-latest
steps:
- name: Post success comment (TestPyPI published)
if: needs.publish-to-testpypi.outputs.testpypi-success == 'true'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ needs.start-workflow.outputs.first-comment-id }}
issue-number: ${{ github.event.inputs.pr }}
reactions: rocket
body: |
> **Prerelease Published to TestPyPI**
>
> Version: `${{ needs.build-prerelease.outputs.version }}`
>
> Install with:
> ```bash
> pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ airbyte==${{ needs.build-prerelease.outputs.version }}
> ```
>
> Or install directly from this PR branch:
> ```bash
> pip install 'git+https://github.com/${{ needs.start-workflow.outputs.source-repo }}.git@${{ needs.start-workflow.outputs.source-branch }}'
> ```

- name: Post success comment (artifacts only)
if: needs.publish-to-testpypi.outputs.testpypi-success != 'true'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ needs.start-workflow.outputs.first-comment-id }}
issue-number: ${{ github.event.inputs.pr }}
reactions: "+1"
body: |
> **Prerelease Build Complete**
>
> Version: `${{ needs.build-prerelease.outputs.version }}`
>
> TestPyPI publish was skipped or failed (this is expected if the version already exists).
>
> You can still install directly from this PR branch:
> ```bash
> pip install 'git+https://github.com/${{ needs.start-workflow.outputs.source-repo }}.git@${{ needs.start-workflow.outputs.source-branch }}'
> ```
>
> Or download the built wheel from the [workflow artifacts](${{ needs.start-workflow.outputs.job-run-url }}).

post-failure-comment:
name: Post Failure Comment
needs: [start-workflow, build-prerelease]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Post failure comment
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ needs.start-workflow.outputs.first-comment-id }}
issue-number: ${{ github.event.inputs.pr }}
reactions: confused
body: |
> **Prerelease Build Failed**
>
> The prerelease build encountered an error.
> [Check job output](${{ needs.start-workflow.outputs.job-run-url }}) for details.
1 change: 1 addition & 0 deletions .github/workflows/slash_command_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
fix-pr
test-pr
poetry-lock
prerelease
static-args: |
pr=${{ github.event.issue.number }}
comment-id=${{ github.event.comment.id }}
Expand Down
Loading