84 lines
3.3 KiB
YAML
84 lines
3.3 KiB
YAML
name: Publish CDK
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry-run:
|
|
description: 'By default dry-run publishes to Test PyPi. Use "false" to publish 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:
|
|
|
|
build-cdk:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
# 3.7.1 - is a minimal of 3.7.X version supported by github actions
|
|
python-version: [3.7.1, 3.7, 3.8, 3.9]
|
|
steps:
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: '14'
|
|
- name: Checkout Airbyte
|
|
uses: actions/checkout@v2
|
|
- name: Build CDK Package
|
|
run: SUB_BUILD=CONNECTORS_BASE ./gradlew --no-daemon --no-build-cache :airbyte-cdk:python:build
|
|
- 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}}
|
|
|
|
publish-cdk:
|
|
needs: build-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: Set PyPi URL
|
|
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:
|
|
# specify the same version as in ~/.python-version
|
|
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}}
|