Skip to content

Commit

Permalink
Merge branch 'issue-19981_avoid-race-condition-on-airbyte-cdk-release…
Browse files Browse the repository at this point in the history
…' into issue-19981_notifications-on-publish-cdk-manually
  • Loading branch information
maxi297 committed Jan 10, 2023
2 parents 9c5eb22 + 710054e commit 936794e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 32 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/publish-cdk-command-manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
description: "The git ref to check out from the specified repository."
required: false
default: master
part-to-bump:
release-type:
type: choice
description: "Choose the type of version upgrade : major|minor|patch"
options:
Expand All @@ -19,25 +19,20 @@ on:
- patch
- none
required: true
dry-run:
type: choice
description: 'By default dry-run publishes to Test PyPi. Use "false" to publish to actual PyPi servers.'
options:
- true
- false
required: true
default: true
skip-publish-test:
description: 'By default, the job publishes to Test PyPi. Use "true" to only publish to actual PyPi servers.'
required: false
changelog-message:
description: "Changelog message to be added to CHANGELOG.md"
required: true
required: false

concurrency:
group: publish-airbyte-cdk
cancel-in-progress: false

jobs:
bump-version:
if: github.event.inputs.part-to-bump != 'none'
if: github.event.inputs.release-type != 'none'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
Expand All @@ -52,15 +47,15 @@ jobs:
run: |
pip install bumpversion
cd airbyte-cdk/python
bumpversion ${{ github.event.inputs.part-to-bump }}
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
if: success()
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.part-to-bump }} version of Airbyte CDK
commit_message: 🤖 Bump ${{ github.event.inputs.release-type }} version of Airbyte CDK
commit_user_name: Octavia Squidington III
commit_user_email: [email protected]
- name: Post failure to Slack channel dev-connectors-extensibility
Expand All @@ -77,7 +72,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Error while publishing Airbyte CDK with dry-run=${{ github.event.inputs.dry-run }}!"
"text": "Error while publishing Airbyte CDK!"
}
},
{
Expand Down Expand Up @@ -124,7 +119,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Error while publishing Airbyte CDK with dry-run=${{ github.event.inputs.dry-run }}!"
"text": "Error while publishing Airbyte CDK!"
}
},
{
Expand All @@ -143,18 +138,23 @@ jobs:
needs: build-cdk
runs-on: ubuntu-latest
steps:
# 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@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/[email protected]
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/[email protected]
with:
Expand All @@ -165,9 +165,8 @@ jobs:
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_REPOSITORY_URL: ${{ env.pypi_url }}
- name: Post success to Slack channel dev-connectors-extensibility
if: github.event.inputs.dry-run == 'false' && success()
if: success()
uses: slackapi/[email protected]
continue-on-error: true
with:
Expand Down Expand Up @@ -208,7 +207,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Error while publishing Airbyte CDK with dry-run=${{ github.event.inputs.dry-run }}!"
"text": "Error while publishing Airbyte CDK!"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion airbyte-cdk/python/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.18.0
current_version = 0.18.1
commit = False

[bumpversion:file:setup.py]
4 changes: 1 addition & 3 deletions airbyte-cdk/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ and the installation should use your local CDK. Note that the local CDK is injec
#### Publishing a new version to PyPi

1. Open a PR
2. Once it is approved and merge, an Airbyte member must run the `Publish CDK Manually` workflow twice
1. Once with `part-to-bump=major|manor|patch` and `dry-run=true` to bump the version and publish to test.pypi.org
2. Another time with `part-to-bump=none` and `dry-run=false` to publish it to the real index of pypi.org.
2. Once it is approved and merge, an Airbyte member must run the `Publish CDK Manually` workflow using `release-type=major|manor|patch` and setting the changelog message.

## Coming Soon

Expand Down
4 changes: 1 addition & 3 deletions docs/connector-development/cdk-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ All tests are located in the `unit_tests` directory. Run `pytest --cov=airbyte_c
#### Publishing a new version to PyPi

1. Open a PR
2. Once it is approved and merge, an Airbyte member must run the `Publish CDK Manually` workflow twice
1. Once with `part-to-bump=major|manor|patch` and `dry-run=true` to bump the version and publish to test.pypi.org
2. Another time with `part-to-bump=none` and `dry-run=false` to publish it to the real index of pypi.org.
2. Once it is approved and merge, an Airbyte member must run the `Publish CDK Manually` workflow using `release-type=major|manor|patch` and setting the changelog message.

## Coming Soon

Expand Down

0 comments on commit 936794e

Please sign in to comment.