-
Notifications
You must be signed in to change notification settings - Fork 71
feat: Add /prerelease slash command for PyPI prereleases
#910
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2162f97
feat: Add /prerelease slash command for TestPyPI prereleases
devin-ai-integration[bot] 4fbe2a7
refactor: Update /prerelease to publish to PyPI and reuse pypi_publis…
devin-ai-integration[bot] b6acdb1
fix: Conditionally set POETRY_DYNAMIC_VERSIONING_BYPASS only when ver…
devin-ai-integration[bot] 488b2ab
refactor: Use explicit step outputs for version override instead of G…
devin-ai-integration[bot] 7b48ddc
refactor: Consolidate success/failure comment jobs into single job wi…
devin-ai-integration[bot] cc5db3f
refactor: Rename jobs to Set up Workflow, Call Publish Workflow, Writ…
devin-ai-integration[bot] 2b57120
refactor: Remove fork check - maintainers can publish from forks if n…
devin-ai-integration[bot] 84361f0
style: Move outputs block to after steps in job definition
devin-ai-integration[bot] 4c42335
fix: Use refs/pull/<PR>/head instead of raw SHA for fork compatibility
devin-ai-integration[bot] 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
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 |
|---|---|---|
| @@ -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. | ||
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.
Uh oh!
There was an error while loading. Please reload this page.