diff --git a/.github/workflows/release-airbyte-os.yml b/.github/workflows/release-airbyte-os.yml index e2786bd6e0f61..ea0837f304c91 100644 --- a/.github/workflows/release-airbyte-os.yml +++ b/.github/workflows/release-airbyte-os.yml @@ -63,15 +63,10 @@ jobs: - uses: actions/setup-node@v1 with: node-version: "16.13.0" - # necessary to install pip - uses: actions/setup-python@v2 with: python-version: "3.7" - - name: Save Old Version - id: old_version - run: | - echo ::set-output name=OLD_VERSION::$(grep -w VERSION .env | cut -d"=" -f2) - name: Release Airbyte id: release_airbyte env: @@ -81,14 +76,63 @@ jobs: CLOUDREPO_PASSWORD: ${{ secrets.CLOUDREPO_PASSWORD }} run: | ./tools/bin/release_version.sh - - name: Save New Version - id: new_version - run: | - echo ::set-output name=NEW_VERSION::$(grep -w VERSION .env | cut -d"=" -f2) + + # We are releasing octavia from a separate job because: + # - The self hosted runner used in releaseAirbyte does not have the docker buildx command to build multi-arch images + # - Plaform build requires Python 3.7, Octavia Build requires 3.8 + releaseOctavia: + runs-on: ubuntu-latest + environment: more-secrets + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-java@v1 + with: + java-version: "17" + + - uses: actions/setup-node@v1 + with: + node-version: "16.13.0" + # octavia-cli build requires Python 3.8. + # We use 3.8 in this project because 3.7 is not supported on Apple M1. + - uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Release Octavia + id: release_octavia + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + PART_TO_BUMP: ${{ github.event.inputs.partToBump }} + run: ./tools/bin/release_version_octavia.sh + + createPullRequest: + needs: + - releaseAirbyte + - releaseOctavia + runs-on: ubuntu-latest + environment: more-secrets + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + # necessary to install pip + - uses: actions/setup-python@v2 + with: + python-version: "3.7" + - name: Bump version + id: bump_version + env: + PART_TO_BUMP: ${{ github.event.inputs.partToBump }} + run: ./tools/bin/bump_version.sh - name: Get PR Body id: pr_body env: - PREV_VERSION: ${{ steps.old_version.outputs.OLD_VERSION }} + PREV_VERSION: ${{ steps.bump_version.outputs.PREV_VERSION }} + NEW_VERSION: ${{ steps.bump_version.outputs.NEW_VERSION }} + GIT_REVISION: ${{ steps.bump_version.outputs.GIT_REVISION }} run: | chmod +x tools/bin/pr_body.sh body=$(./tools/bin/pr_body.sh) @@ -102,9 +146,9 @@ jobs: branch: bump-version branch-suffix: random delete-branch: true - title: Bump Airbyte version from ${{ steps.old_version.outputs.OLD_VERSION }} to ${{ steps.new_version.outputs.NEW_VERSION }} + title: Bump Airbyte version from ${{ steps.bump_version.outputs.PREV_VERSION }} to ${{ steps.bump_version.outputs.NEW_VERSION }} body: ${{ steps.pr_body.outputs.PR_BODY }} - commit-message: Bump Airbyte version from ${{ steps.old_version.outputs.OLD_VERSION }} to ${{ steps.new_version.outputs.NEW_VERSION }} + commit-message: Bump Airbyte version from ${{ steps.bump_version.outputs.PREV_VERSION }} to ${{ steps.bump_version.outputs.NEW_VERSION }} - name: PR Details run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" diff --git a/tools/bin/bump_version.sh b/tools/bin/bump_version.sh new file mode 100755 index 0000000000000..10f95bc9ab4a2 --- /dev/null +++ b/tools/bin/bump_version.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -eu +PREV_VERSION=$(grep -w VERSION .env | cut -d"=" -f2) +GIT_REVISION=$(git rev-parse HEAD) + +pip install bumpversion +bumpversion "$PART_TO_BUMP" + +NEW_VERSION=$(grep -w VERSION .env | cut -d"=" -f2) + +echo "Bumped version from ${PREV_VERSION} to ${NEW_VERSION}" +echo ::set-output name=PREV_VERSION::${PREV_VERSION} +echo ::set-output name=NEW_VERSION::${NEW_VERSION} +echo ::set-output name=GIT_REVISION::${GIT_REVISION} diff --git a/tools/bin/pr_body.sh b/tools/bin/pr_body.sh index 53b59d510cec6..a2a77839826e8 100755 --- a/tools/bin/pr_body.sh +++ b/tools/bin/pr_body.sh @@ -4,7 +4,6 @@ set -e . tools/lib/lib.sh -GIT_REVISION=$(git rev-parse HEAD) [[ -z "$GIT_REVISION" ]] && echo "Couldn't get the git revision..." && exit 1 echo "*IMPORTANT: Only merge if the platform build is passing!*" diff --git a/tools/bin/release_version.sh b/tools/bin/release_version.sh index e2e246aa2842d..1a6b029e8c42a 100755 --- a/tools/bin/release_version.sh +++ b/tools/bin/release_version.sh @@ -21,24 +21,10 @@ fi docker login -u airbytebot -p "${DOCKER_PASSWORD}" -PREV_VERSION=$(grep -w VERSION .env | cut -d"=" -f2) - -[[ -z "$PART_TO_BUMP" ]] && echo "Usage ./tools/bin/release_version.sh (major|minor|patch)" && exit 1 - -# uses .bumpversion.cfg to find files to bump -# requires no git diffs to run -# commits the bumped versions code to your branch -pip install bumpversion -bumpversion "$PART_TO_BUMP" - -NEW_VERSION=$(grep -w VERSION .env | cut -d"=" -f2) -GIT_REVISION=$(git rev-parse HEAD) -[[ -z "$GIT_REVISION" ]] && echo "Couldn't get the git revision..." && exit 1 - -echo "Bumped version from ${PREV_VERSION} to ${NEW_VERSION}" -echo "Building and publishing version $NEW_VERSION for git revision $GIT_REVISION..." +source ./tools/bin/bump_version.sh +echo "Building and publishing PLATFORM version $NEW_VERSION for git revision $GIT_REVISION..." VERSION=$NEW_VERSION SUB_BUILD=PLATFORM ./gradlew clean build SUB_BUILD=PLATFORM ./gradlew publish VERSION=$NEW_VERSION GIT_REVISION=$GIT_REVISION docker-compose -f docker-compose.build.yaml push -echo "Completed building and publishing..." +echo "Completed building and publishing PLATFORM..." diff --git a/tools/bin/release_version_octavia.sh b/tools/bin/release_version_octavia.sh new file mode 100755 index 0000000000000..47b3d9f8029e7 --- /dev/null +++ b/tools/bin/release_version_octavia.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +. tools/lib/lib.sh + +if test -z "${DOCKER_PASSWORD}"; then + echo 'DOCKER_PASSWORD for airbytebot not set.'; + exit 1; +fi + +docker login --username airbytebot --password "${DOCKER_PASSWORD}" + +source ./tools/bin/bump_version.sh + +echo "Building and publishing OCTAVIA version ${NEW_VERSION} for git revision ${GIT_REVISION}..." +VERSION=$NEW_VERSION SUB_BUILD=OCTAVIA_CLI ./gradlew clean build +./octavia-cli/publish.sh ${NEW_VERSION} ${GIT_REVISION} +echo "Completed building and publishing OCTAVIA..."