223 lines
8.4 KiB
YAML
223 lines
8.4 KiB
YAML
name: Publish CDK Manually
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
repo:
|
|
description: "Repo to check out code from. Defaults to the main airbyte repo. Set this when building connectors from forked repos."
|
|
required: false
|
|
default: "airbytehq/airbyte"
|
|
gitref:
|
|
description: "The git ref to check out from the specified repository."
|
|
required: false
|
|
default: master
|
|
release-type:
|
|
type: choice
|
|
description: "Choose the type of version upgrade : major|minor|patch"
|
|
options:
|
|
- none
|
|
- major
|
|
- minor
|
|
- patch
|
|
required: true
|
|
skip-publish-test:
|
|
description: 'By default, the job publishes to both Test and actual PyPi. Use "true" to only publish to actual PyPi servers.'
|
|
required: false
|
|
changelog-message:
|
|
description: "Changelog message to be added to CHANGELOG.md"
|
|
required: false
|
|
|
|
concurrency:
|
|
group: publish-airbyte-cdk
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
bump-version:
|
|
if: github.event.inputs.release-type != 'none'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.9"
|
|
- name: Checkout Airbyte
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ github.event.inputs.repo }}
|
|
ref: ${{ github.event.inputs.gitref }}
|
|
token: ${{ secrets.AIRBYTEIO_PAT }}
|
|
- name: "Publish Airbyte CDK: bump version"
|
|
run: |
|
|
pip install bumpversion
|
|
cd airbyte-cdk/python
|
|
bumpversion ${{ github.event.inputs.release-type }}
|
|
new_version="$(grep -i 'current_version = ' .bumpversion.cfg | sed -e 's/.* = //')"
|
|
awk -v NEW_VERSION="$new_version" -v CHANGELOG_MESSAGE="${{ github.event.inputs.changelog-message }}" 'NR==3{print "## " NEW_VERSION "\n" CHANGELOG_MESSAGE "\n"}1' CHANGELOG.md > tmp && mv tmp CHANGELOG.md
|
|
- name: Commit and Push Changes
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
file_pattern: airbyte-cdk/python/setup.py airbyte-cdk/python/.bumpversion.cfg airbyte-cdk/python/CHANGELOG.md
|
|
commit_message: 🤖 Bump ${{ github.event.inputs.release-type }} version of Airbyte CDK
|
|
commit_user_name: Octavia Squidington III
|
|
commit_user_email: octavia-squidington-iii@users.noreply.github.com
|
|
- name: Post failure to Slack channel dev-connectors-extensibility
|
|
if: ${{ failure() }}
|
|
uses: slackapi/slack-github-action@v1.23.0
|
|
continue-on-error: true
|
|
with:
|
|
channel-id: C04J1M66D8B
|
|
payload: |
|
|
{
|
|
"text": "Error during `bump-version` while publishing Airbyte CDK!",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "Error while publishing Airbyte CDK!"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "See details on <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|GitHub>\n"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
|
|
|
|
build-cdk:
|
|
needs: bump-version
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.9"
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "zulu"
|
|
java-version: "17"
|
|
- name: Checkout Airbyte
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ github.event.inputs.repo }}
|
|
ref: ${{ github.event.inputs.gitref }}
|
|
- name: Build CDK Package
|
|
run: SUB_BUILD=CONNECTORS_BASE ./gradlew --no-daemon --no-build-cache :airbyte-cdk:python:build
|
|
- name: Post failure to Slack channel dev-connectors-extensibility
|
|
if: ${{ failure() }}
|
|
uses: slackapi/slack-github-action@v1.23.0
|
|
continue-on-error: true
|
|
with:
|
|
channel-id: C04J1M66D8B
|
|
payload: |
|
|
{
|
|
"text": "Error during `build-cdk` while publishing Airbyte CDK!",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "Error while publishing Airbyte CDK!"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "See details on <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|GitHub>\n"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
|
|
|
|
publish-cdk:
|
|
needs: build-cdk
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Airbyte
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ github.event.inputs.repo }}
|
|
ref: ${{ github.event.inputs.gitref }}
|
|
- name: Publish Python Package to test.pypi.org
|
|
if: github.event.inputs.skip-publish-test != 'true'
|
|
uses: mariamrf/py-package-publish-action@v1.1.0
|
|
with:
|
|
# specify the same version as in ~/.python-version
|
|
python_version: "3.9.11"
|
|
pip_version: "21.1"
|
|
subdir: "airbyte-cdk/python/"
|
|
env:
|
|
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
|
|
TWINE_REPOSITORY_URL: "https://test.pypi.org/legacy/"
|
|
- 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.9.11"
|
|
pip_version: "21.1"
|
|
subdir: "airbyte-cdk/python/"
|
|
env:
|
|
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
|
|
- name: Post success to Slack channel dev-connectors-extensibility
|
|
uses: slackapi/slack-github-action@v1.23.0
|
|
continue-on-error: true
|
|
with:
|
|
channel-id: C04J1M66D8B
|
|
payload: |
|
|
{
|
|
"text": "A new version of Airbyte CDK has been released!",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "A new version of Airbyte CDK has been released with changelog: ${{ github.event.inputs.changelog-message }}!\n\n"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "See details on <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|GitHub>\n"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
|
|
- name: Post failure to Slack channel dev-connectors-extensibility
|
|
if: ${{ failure() }}
|
|
uses: slackapi/slack-github-action@v1.23.0
|
|
continue-on-error: true
|
|
with:
|
|
channel-id: C04J1M66D8B
|
|
payload: |
|
|
{
|
|
"text": "Error during `publish-cdk` while publishing Airbyte CDK!",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "Error while publishing Airbyte CDK!"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "See details on <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|GitHub>\n"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
|