1
0
mirror of synced 2026-01-10 00:03:08 -05:00
Files
airbyte/.github/workflows/publish-cdk-command.yml
Davin Chia ced243881b Add CDK publishing setup. (#3156)
Allow us to publish CDK versions on PyPi via Github workflows.

This lets us:
- Version CDK moving forward
- Publish via Github actions to both PyPi and test PyPi for test releases.

Note, this will not work on this branch as Github only detects new workflows after they are checked into master, so I was forced to develop and test this from a fork. Browse this PR or this PR to see this command in action.

Added publishing instructions to the Release Document.
2021-05-03 08:38:47 +08:00

56 lines
2.4 KiB
YAML

name: Publish CDK
on:
workflow_dispatch:
inputs:
dry-run:
description: 'Indicates whether this is a dry-run or not. A dry-run publishes to Test PyPi. A proper run publishes to actual PyPi servers.'
required: false
comment-id:
description: 'The comment-id of the slash command. Used to update the comment with the status.'
required: false
jobs:
publish-cdk:
runs-on: ubuntu-latest
steps:
- name: Link comment to workflow run
if: github.event.inputs.comment-id
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ github.event.inputs.comment-id }}
body: |
> :clock2: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
# Make use of env vars to dynamically set the PyPi url. Since the default is set to publish to production PyPi, only set the url if during
# a dry-run publish to the Test PyPi servers.
- name: Publish to test PyPi if dry-run.
if: github.event.inputs.dry-run != 'false'
run: |
echo ${{ github.event.inputs.dry-run }}
echo "pypi_url=https://test.pypi.org/legacy/" >> $GITHUB_ENV
- name: Checkout Airbyte
uses: actions/checkout@v2
- name: Publish Python Package
uses: mariamrf/py-package-publish-action@v1.1.0
with:
python_version: '3.7.9'
pip_version: '21.1'
subdir: 'airbyte-cdk/python/'
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_REPOSITORY_URL: ${{ env.pypi_url }}
- name: Add Success Comment
if: github.event.inputs.comment-id && success()
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ github.event.inputs.comment-id }}
body: |
> :white_check_mark: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
- name: Add Failure Comment
if: github.event.inputs.comment-id && !success()
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ github.event.inputs.comment-id }}
body: |
> :x: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}