diff --git a/.github/workflows/publish-cdk-command-manually.yml b/.github/workflows/publish-cdk-command-manually.yml index 908f67e128b6..3424505bf3b5 100644 --- a/.github/workflows/publish-cdk-command-manually.yml +++ b/.github/workflows/publish-cdk-command-manually.yml @@ -1,10 +1,5 @@ name: Publish CDK Manually on: - push: - paths: - - '**.yml' - branches: - - issue-19981_avoid-race-condition-on-airbyte-cdk-release workflow_dispatch: inputs: repo: @@ -27,7 +22,7 @@ on: dry-run: description: 'By default dry-run publishes to Test PyPi. Use "false" to publish to actual PyPi servers.' required: false - changelog: + changelog-message: description: "Changelog message to be added to CHANGELOG.md" required: true @@ -52,44 +47,17 @@ jobs: run: | pip install bumpversion cd airbyte-cdk/python - bumpversion patch + bumpversion ${{ github.event.inputs.part-to-bump }} new_version="$(grep -i 'current_version = ' .bumpversion.cfg | sed -e 's/.* = //')" - awk -v NEW_VERSION="$new_version" -v CHANGELOG_MESSAGE="This is a changelog message for testing purposes" 'NR==3{print "## " NEW_VERSION "\n" CHANGELOG_MESSAGE "\n"}1' CHANGELOG.md > tmp && mv tmp CHANGELOG.md + 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 patch version of Airbyte CDK + commit_message: 🤖 Bump ${{ github.event.inputs.part-to-bump }} version of Airbyte CDK commit_user_name: Octavia Squidington III commit_user_email: octavia-squidington-iii@users.noreply.github.com - - name: Post to a Slack channel - id: slack - uses: slackapi/slack-github-action@v1.23.0 - continue-on-error: true - with: - channel-id: C04HMCXBP46 - payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "This is a test!\n\n" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "See details on \n" - } - } - ] - } - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }} build-cdk: needs: bump-version @@ -109,59 +77,31 @@ jobs: 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: 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@v3 -# with: -# repository: ${{ github.event.inputs.repo }} -# ref: ${{ github.event.inputs.gitref }} -# - 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 }} -# 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}} + publish-cdk: + 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 + 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: ${{ env.pypi_url }} diff --git a/.github/workflows/publish-cdk-command.yml b/.github/workflows/publish-cdk-command.yml deleted file mode 100644 index 18113a11bfce..000000000000 --- a/.github/workflows/publish-cdk-command.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Publish CDK -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 - 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: - python-version: ["3.9"] - steps: - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - 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: 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@v3 - with: - repository: ${{ github.event.inputs.repo }} - ref: ${{ github.event.inputs.gitref }} - - 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 }} - 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}} diff --git a/.github/workflows/slash-commands.yml b/.github/workflows/slash-commands.yml index e0a3b2e1ec37..866f6c4e11ff 100644 --- a/.github/workflows/slash-commands.yml +++ b/.github/workflows/slash-commands.yml @@ -38,7 +38,6 @@ jobs: publish-connector publish publish-external - publish-cdk gke-kube-test run-specific-test static-args: | diff --git a/airbyte-cdk/python/README.md b/airbyte-cdk/python/README.md index b62a3c21c607..ed128aa9047d 100644 --- a/airbyte-cdk/python/README.md +++ b/airbyte-cdk/python/README.md @@ -140,9 +140,10 @@ and the installation should use your local CDK. Note that the local CDK is injec **Note:** if your connector uses a `.dockerignore` file, it cannot have `exclude-all` or `exclude-except` patterns, i.e. the `.dockerignore` must specifically say which files to ignore without using any regex. #### Publishing a new version to PyPi -1. Bump the package version in `setup.py` -2. Open a PR -3. An Airbyte member must comment `/publish-cdk dry-run=true` to publish the package to test.pypi.org or `/publish-cdk dry-run=false` to publish it to the real index of pypi.org. +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. ## Coming Soon diff --git a/docs/connector-development/cdk-python/README.md b/docs/connector-development/cdk-python/README.md index 878329d86b03..0871dbeba0cc 100644 --- a/docs/connector-development/cdk-python/README.md +++ b/docs/connector-development/cdk-python/README.md @@ -99,9 +99,10 @@ All tests are located in the `unit_tests` directory. Run `pytest --cov=airbyte_c #### Publishing a new version to PyPi -1. Bump the package version in `setup.py` -2. Open a PR -3. An Airbyte member must comment `/publish-cdk dry-run=true` to publish the package to test.pypi.org or `/publish-cdk dry-run=false` to publish it to the real index of pypi.org. +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. ## Coming Soon