From 1930df5ae395a60b55669fd3af9476d9ed6f94c1 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Wed, 31 Jan 2024 10:43:41 -0600 Subject: [PATCH] rework release after hatch implementation --- .github/workflows/build.yml | 22 ++ .github/workflows/build_hatch.yml | 271 ----------------------- .github/workflows/release.yml | 266 +++++++--------------- .github/workflows/release_prep_hatch.yml | 79 +++---- 4 files changed, 129 insertions(+), 509 deletions(-) delete mode 100644 .github/workflows/build_hatch.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b50bd1c5..d12d3200 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,12 @@ on: merge_group: types: [checks_requested] workflow_dispatch: + workflow_call: + inputs: + changelog_path: + description: "Path to changelog file" + required: true + type: string permissions: read-all @@ -53,3 +59,19 @@ jobs: - name: "Check build" run: hatch run build:check-all + + - name: "Check version" + id: version + run: | + echo "version=$(hatch version)" >> $GITHUB_OUTPUT + + # this step is only needed for the release process + - name: "Upload Build Artifact" + if: ${{ github.event_name == 'workflow_call' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.version.outputs.version_number }} + path: | + ${{ inputs.changelog_path }} + ./dist/ + retention-days: 3 diff --git a/.github/workflows/build_hatch.yml b/.github/workflows/build_hatch.yml deleted file mode 100644 index 42b6aad1..00000000 --- a/.github/workflows/build_hatch.yml +++ /dev/null @@ -1,271 +0,0 @@ -# **what?** -# Build release artifacts and store them to S3 bucket if they do not already exist. -# -# Expected build artifact layout: -# -# ├── dist -# │ ├── dbt-*.tar.gz -# │ ├── dbt-*.whl -# └── .md -# -# -# Notes: -# - resolves based on `test_run` and `nightly_release` inputs. -# nightly_release == true will use "nightly-releases" -# nightly_release == false resolves based on `test_run` input -# test_run == true will use "artifacts_testing" -# test_run == false will use "artifacts" -# -# Examples: -# nightly_release == true: "s3://core-team-artifacts/dbt-labs/dbt-core/nightly-releases/1.4.0a1.dev01112023+nightly/aaa410f17d300f1bde2cd67c03e48df135ab347b" -# test_run == true : "s3://core-team-artifacts/dbt-labs/dbt-core/artifacts_testing/1.2.3/ce98e6f067d9fa63a9b213bf99ebaf0c29d2b7eb/" -# test_run == false : "s3://core-team-artifacts/dbt-labs/dbt-core/artifacts/1.2.3/ce98e6f067d9fa63a9b213bf99ebaf0c29d2b7eb/" -# -# Inputs: -# sha: The commit to attach to this release -# version_number: The release version number (i.e. 1.0.0b1, 1.2.3rc2, 1.0.0) -# changelog_path: Path to the changelog file for release notes -# package_test_command: Command to use to check package runs -# test_run: Test run (Bucket to upload the artifact) -# nightly_release: Identifier that this is nightly release -# -# **why?** -# Reusable and consistent build process. -# -# **when?** -# Call after a successful version bump up. -# This workflow expects that the package version is bumped and the associated changelog living in sources. -# -# Validation Checks -# -# 1. Make sure the sha has a changelog entry for this version and the version bump has been completed. -# 2. Upload artifacts - -name: Build - -on: - workflow_call: - inputs: - sha: - required: true - type: string - version_number: - required: true - type: string - changelog_path: - required: true - type: string - package_test_command: - required: true - default: "dbt --version" - type: string - test_run: - required: false - default: true - type: boolean - nightly_release: - required: false - default: false - type: boolean - - # pass through secrets so every repo can have their own and won't depend on a name - secrets: - AWS_ACCESS_KEY_ID: - description: AWS Access Key ID - required: true - AWS_SECRET_ACCESS_KEY: - description: AWS Access Key - required: true - -permissions: - contents: write - # this will be needed if we go with OIDC for auth instead of managing secrets in github for AWS - # id-token: write # https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-cloud-providers#adding-permissions-settings - -env: - ARTIFACT_RETENTION_DAYS: 2 - AWS_REGION: "us-east-1" - PYTHON_TARGET_VERSION: 3.8 - NOTIFICATION_PREFIX: "[Build]" - -jobs: - log-inputs: - runs-on: ubuntu-latest - steps: - - name: "[DEBUG] Print Variables" - run: | - # WORKFLOW INPUTS - echo The last commit sha in the release: ${{ inputs.sha }} - echo The release version number: ${{ inputs.version_number }} - echo The changelog path: ${{ inputs.changelog_path }} - echo The package test command: ${{ inputs.package_test_command }} - echo Test run: ${{ inputs.test_run }} - echo Nightly release: ${{ inputs.nightly_release }} - # ENVIRONMENT VARIABLES - echo GitHub artifact retention days: ${{ env.ARTIFACT_RETENTION_DAYS }} - echo Amazon Web Services region: ${{ env.AWS_REGION }} - echo Python target version: ${{ env.PYTHON_TARGET_VERSION }} - echo Notification prefix: ${{ env.NOTIFICATION_PREFIX }} - - audit-version-changelog: - # Make sure the changelog has been generated and the version is up to date - runs-on: ubuntu-latest - - steps: - - name: "Checkout ${{ github.repository }} Commit ${{ inputs.sha }}" - uses: actions/checkout@v3 - with: - ref: ${{ inputs.sha }} - - - name: "Set up Python & Hatch - ${{ env.PYTHON_TARGET_VERSION }}" - uses: ./.github/actions/setup-python-env - with: - python-version: "3.11" - - - name: "Audit Version And Parse Into Parts" - id: semver - uses: dbt-labs/actions/parse-semver@v1.1.0 - with: - version: ${{ inputs.version_number }} - - - name: "Audit Changelog Exists" - run: | - title="Audit Changelog Exists" - if test -f ${{ inputs.changelog_path }} - then - message="Specified file ${{ inputs.changelog_path }} - exists." - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - else - message="Specified file ${{ inputs.changelog_path }} does not exist! The changelog for this release must exist before running this workflow." - git status - echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - exit 1 - fi - - - name: "Check Current Version In Code" - id: set_status - run: | - title="Check Current Version In Code" - current_version=$(hatch version) - if test "$current_version" = "${{ inputs.version_number }}" - then - message="Version set to ${{ inputs.version_number }}." - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - else - message="Version not set to ${{ inputs.version_number }}. The version bump workflow must be complete before running this workflow." - git status - echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - exit 1 - fi - - unit: - name: Unit Test - runs-on: ubuntu-latest - needs: [audit-version-changelog] - - steps: - - name: "Checkout ${{ github.repository }} Commit ${{ inputs.sha }}" - uses: actions/checkout@v3 - with: - persist-credentials: false - ref: ${{ inputs.sha }} - - - name: "Set up Python & Hatch - ${{ env.PYTHON_TARGET_VERSION }}" - uses: ./.github/actions/setup-python-env - with: - python-version: ${{ env.PYTHON_TARGET_VERSION }} - - - name: "Run Unit Tests" - run: hatch run test:unit - - build-packages: - runs-on: ubuntu-latest - needs: [unit] - - outputs: - finished: ${{ steps.set_success.outputs.finished }} - - steps: - - name: "Checkout Commit - ${{ inputs.sha }}" - uses: actions/checkout@v3 - with: - persist-credentials: false - ref: ${{ inputs.sha }} - - - name: "Set up Python & Hatch - ${{ env.PYTHON_TARGET_VERSION }}" - uses: ./.github/actions/setup-python-env - with: - python-version: ${{ env.PYTHON_TARGET_VERSION }} - - - name: "Build Python Package" - run: | - hatch build - - # upload artifact in case something fails in verification so we can look at it - - name: "Upload Build Artifact - ${{ inputs.version_number }}" - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.version_number }} - # TODO: check these paths - path: | - ${{ inputs.changelog_path }} - ./dist/ - !dist/dbt-${{ inputs.version_number }}.tar.gz - retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }} - - test-build: - runs-on: ubuntu-latest - needs: [build-packages] - - steps: - - name: "Set up Python - ${{ env.PYTHON_TARGET_VERSION }}" - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_TARGET_VERSION }} - - - name: "Install Python Dependencies" - run: | - python -m pip install --user --upgrade pip - python -m pip install --upgrade wheel - python -m pip --version - - - name: "Download Build Artifact - ${{ inputs.version_number }}" - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.version_number }} - path: . - - - name: "[DEBUG] Display Structure Of All Downloaded Files" - run: ls -R - - - name: "[DEBUG] Show Distributions" - run: ls -lh dist/ - - - name: "Show distributions" - run: ls -lh dist/ - - - name: "Check distribution descriptions" - run: | - twine check dist/* - - - name: "Check wheel contents" - run: | - check-wheel-contents dist/*.whl --ignore W007,W008 - - - name: "Install wheel distributions" - run: | - find ./dist/dbt_common-*.whl -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/ - - # TODO: how to validate here? we did dbt --version previously. this checks it's there, but not that it can do anything. maybe it's enough? - - name: "Check wheel distributions" - run: | - pip freeze | grep dbt-common - - - name: "Install source distributions" - run: | - find ./dist/dbt_common-*.gz -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/ - - # TODO: how to validate here? we did dbt --version previously. this checks it's there, but not that it can do anything. maybe it's enough? - - name: "Check source distributions" - run: | - pip freeze | grep dbt-common diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 362df5b3..c494beeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,7 @@ on: - PypiTest default: PypiTest + # target_branch: # description: "The branch to release from" # type: string @@ -66,12 +67,6 @@ on: # default: false # required: false -<<<<<<< HEAD -======= -env: - ENV_SETUP_SCRIPT_PATH: "scripts/env-setup.sh" # TODO: This isn't needed for dbt-common - PACKAGE_TEST_COMMAND: "tbd..." # this should probably be the hatch command/script ->>>>>>> 7034ccc (fix up publishing) permissions: contents: write # this is the permission that allows creating a new release @@ -85,12 +80,45 @@ concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} cancel-in-progress: true -jobs: -<<<<<<< HEAD +# jobs: + +# release: +# name: PyPI - ${{ inputs.deploy-to }} +# runs-on: ubuntu-latest +# environment: +# name: ${{ inputs.deploy-to }} +# permissions: +# id-token: write # IMPORTANT: this permission is mandatory for trusted publishing - release: - name: PyPI - ${{ inputs.deploy-to }} -======= +# steps: +# - name: Check out repository +# uses: actions/checkout@v4 +# with: +# persist-credentials: false + +# - name: "Set up Python & Hatch - 3.11" +# uses: ./.github/actions/setup-python-hatch +# with: +# python-version: "3.11" + +# - name: Build artifacts +# run: hatch build +# shell: bash + +# - name: Check artifacts +# run: hatch run build:check-all +# shell: bash + +# - name: Publish artifacts to PyPI Test +# if: inputs.deploy-to == 'PypiTest' +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# repository-url: https://test.pypi.org/legacy/ + +# - name: Publish artifacts to PyPI Prod +# if: inputs.deploy-to == 'PypiProd' +# uses: pypa/gh-action-pypi-publish@release/v1 +jobs: log-inputs: name: Log Inputs runs-on: ubuntu-latest @@ -98,13 +126,9 @@ jobs: - name: "[DEBUG] Print Variables" run: | echo "***INPUTS***" - echo The branch to release from: ${{ inputs.target_branch }} echo The release version number: ${{ inputs.version_number }} echo Test run: ${{ inputs.test_run }} echo Nightly release: ${{ inputs.nightly_release }} - echo "***ENV VARS***" - echo Environment setup script path: ${{ env.ENV_SETUP_SCRIPT_PATH }} - echo Package test command: ${{ env.PACKAGE_TEST_COMMAND }} bump-version-generate-changelog: @@ -114,8 +138,6 @@ jobs: with: version_number: ${{ inputs.version_number }} - target_branch: ${{ inputs.target_branch }} - env_setup_script_path: ${{ env.ENV_SETUP_SCRIPT_PATH }} test_run: ${{ inputs.test_run }} nightly_release: ${{ inputs.nightly_release }} @@ -127,192 +149,66 @@ jobs: needs: [bump-version-generate-changelog] ->>>>>>> 7034ccc (fix up publishing) runs-on: ubuntu-latest - environment: - name: ${{ inputs.deploy-to }} - permissions: - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: "Set up Python & Hatch - 3.11" - uses: ./.github/actions/setup-python-hatch - with: - python-version: "3.11" - - - name: Build artifacts - run: hatch build - shell: bash - -<<<<<<< HEAD - - name: Check artifacts - run: hatch run build:check-all - shell: bash - - - name: Publish artifacts to PyPI Test - if: inputs.deploy-to == 'PypiTest' - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - - - name: Publish artifacts to PyPI Prod - if: inputs.deploy-to == 'PypiProd' - uses: pypa/gh-action-pypi-publish@release/v1 -# jobs: -# log-inputs: -# name: Log Inputs -# runs-on: ubuntu-latest -# steps: -# - name: "[DEBUG] Print Variables" -# run: | -# echo "***INPUTS***" -# echo The branch to release from: ${{ inputs.target_branch }} -# echo The release version number: ${{ inputs.version_number }} -# echo Test run: ${{ inputs.test_run }} -# echo Nightly release: ${{ inputs.nightly_release }} -# echo "***ENV VARS***" -# echo Environment setup script path: ${{ env.ENV_SETUP_SCRIPT_PATH }} -# echo AWS S3 bucket name: ${{ env.S3_BUCKET_NAME }} -# echo Package test command: ${{ env.PACKAGE_TEST_COMMAND }} -======= + - name: Print variables + run: | + echo Final SHA : ${{ needs.bump-version-generate-changelog.outputs.final_sha }} + echo Changelog path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} + + build-test-package: + name: Build, Test, Package + if: ${{ !failure() && !cancelled() }} + needs: [bump-version-generate-changelog] + + uses: dbt-labs/dbt-common/.github/workflows/build.yml@er/releases with: - sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} - version_number: ${{ inputs.version_number }} changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} - package_test_command: ${{ env.PACKAGE_TEST_COMMAND }} - test_run: ${{ inputs.test_run }} - nightly_release: ${{ inputs.nightly_release }} github-release: name: GitHub Release if: ${{ !failure() && !cancelled() }} ->>>>>>> 7034ccc (fix up publishing) + needs: [bump-version-generate-changelog, build-test-package] -<<<<<<< HEAD -<<<<<<< HEAD -# bump-version-generate-changelog: -# name: Bump package version, Generate changelog -======= - uses: dbt-labs/dbt-common/.github/workflows/github_release_hatch.yml@er/release ->>>>>>> 7034ccc (fix up publishing) -======= uses: dbt-labs/dbt-release/.github/workflows/github-release.yml@main ->>>>>>> 6aee97b (cleanup github release) - -# uses: dbt-labs/dbt-common/.github/workflows/release_prep_hatch.yml@er/release - -<<<<<<< HEAD -# with: -# version_number: ${{ inputs.version_number }} -# target_branch: ${{ inputs.target_branch }} -# env_setup_script_path: ${{ env.ENV_SETUP_SCRIPT_PATH }} -# test_run: ${{ inputs.test_run }} -# nightly_release: ${{ inputs.nightly_release }} -======= + + with: + version_number: ${{ inputs.version_number }} + changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} + test_run: ${{ inputs.test_run }} + + # TODO: this should be updated to use trusted publishers for these repos. adapters could also start + # using it at that point. core/postgres are in the same repo and therefore can't use trusted publisers + # right now which is why this doesn't currently use it. It can't be updated until the project is set + # up in PyPI and we can't set it up in PyPI until we have a release. Chicken and egg. pypi-release: name: PyPI Release ->>>>>>> 7034ccc (fix up publishing) -# secrets: inherit + needs: [github-release] -<<<<<<< HEAD -# log-outputs-bump-version-generate-changelog: -# name: "[Log output] Bump package version, Generate changelog" -# if: ${{ !failure() && !cancelled() }} -======= - uses: dbt-labs/dbt-common/.github/workflows/pypi_release_trusted_publisher.yml@er/release ->>>>>>> 7034ccc (fix up publishing) + uses: dbt-labs/dbt-common/.github/workflows/pypi-release_trusted_publisher.yml@main -# needs: [bump-version-generate-changelog] - -<<<<<<< HEAD -# runs-on: ubuntu-latest + with: + version_number: ${{ inputs.version_number }} + test_run: ${{ inputs.test_run }} -# steps: -# - name: Print variables -# run: | -# echo Final SHA : ${{ needs.bump-version-generate-changelog.outputs.final_sha }} -# echo Changelog path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} -======= slack-notification: name: Slack Notification if: ${{ failure() && (!inputs.test_run || inputs.nightly_release) }} ->>>>>>> 7034ccc (fix up publishing) - -# build-test-package: -# name: Build, Test, Package -# if: ${{ !failure() && !cancelled() }} -# needs: [bump-version-generate-changelog] - -# uses: dbt-labs/dbt-common/.github/workflows/build_hatch.yml@er/release - -# with: -# sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} -# version_number: ${{ inputs.version_number }} -# changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} -# s3_bucket_name: ${{ env.S3_BUCKET_NAME }} -# package_test_command: ${{ env.PACKAGE_TEST_COMMAND }} -# test_run: ${{ inputs.test_run }} -# nightly_release: ${{ inputs.nightly_release }} - -# secrets: -# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} -# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - -# github-release: -# name: GitHub Release -# if: ${{ !failure() && !cancelled() }} - -# needs: [bump-version-generate-changelog, build-test-package] - -# uses: dbt-labs/dbt-release/.github/workflows/github-release.yml@main - -# with: -# sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} -# version_number: ${{ inputs.version_number }} -# changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} -# test_run: ${{ inputs.test_run }} - -# # TODO: this should be updated to use trusted publishers for these repos. adapters could also start -# # using it at that point. core/postgres are in the same repo and therefore can't use trusted publisers -# # right now which is why this doesn't currently use it. It can't be updated until the project is set -# # up in PyPI and we can't set it up in PyPI until we have a release. Chicken and egg. -# pypi-release: -# name: PyPI Release - -# needs: [github-release] - -# uses: dbt-labs/dbt-release/.github/workflows/pypi-release.yml@main - -# with: -# version_number: ${{ inputs.version_number }} -# test_run: ${{ inputs.test_run }} - -# secrets: -# PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} -# TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} - -# slack-notification: -# name: Slack Notification -# if: ${{ failure() && (!inputs.test_run || inputs.nightly_release) }} - -# needs: -# [ -# bump-version-generate-changelog, -# build-test-package, -# github-release, -# pypi-release, -# ] - -# uses: dbt-labs/dbt-release/.github/workflows/slack-post-notification.yml@main -# with: -# status: "failure" - -# secrets: -# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_CORE_ALERTS }} + + needs: + [ + bump-version-generate-changelog, + build-test-package, + github-release, + pypi-release, + ] + + uses: dbt-labs/dbt-release/.github/workflows/slack-post-notification.yml@main + with: + status: "failure" + + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_CORE_ALERTS }} diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index af78ec5f..e5eca4a6 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -42,13 +42,6 @@ on: version_number: required: true type: string - target_branch: - required: true - type: string - env_setup_script_path: - required: false - type: string - default: "" test_run: required: false default: true @@ -57,6 +50,13 @@ on: type: boolean default: false required: false + env_setup_script_path: + type: string + required: false + default: '' + run-integration-tests: + type: boolean + default: false outputs: changelog_path: description: The path to the changelog for this version @@ -77,7 +77,7 @@ defaults: shell: bash env: - PYTHON_TARGET_VERSION: 3.8 + PYTHON_TARGET_VERSION: 3.11 NOTIFICATION_PREFIX: "[Release Preparation]" jobs: @@ -89,9 +89,9 @@ jobs: run: | # WORKFLOW INPUTS echo The release version number: ${{ inputs.version_number }} - echo The branch that we will release from: ${{ inputs.target_branch }} echo Test run: ${{ inputs.test_run }} echo Nightly release: ${{ inputs.nightly_release }} + echo Optional env setup script: ${{ inputs.env_setup_script_path }} # ENVIRONMENT VARIABLES echo Python target version: ${{ env.PYTHON_TARGET_VERSION }} echo Notification prefix: ${{ env.NOTIFICATION_PREFIX }} @@ -108,7 +108,7 @@ jobs: steps: - name: "Checkout ${{ github.repository }}" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Audit Version And Parse Into Parts" id: semver @@ -233,10 +233,8 @@ jobs: branch_name: ${{ steps.variables.outputs.branch_name }} steps: - - name: "Checkout ${{ github.repository }} Branch ${{ inputs.target_branch }}" + - name: "Checkout ${{ github.repository }}" uses: actions/checkout@v4 - with: - ref: ${{ inputs.target_branch }} - name: "Generate Branch Name" id: variables @@ -287,14 +285,12 @@ jobs: brew install pre-commit brew tap miniscruff/changie https://github.com/miniscruff/changie brew install changie - brew install hatch - name: "Set json File Name" id: json_file run: | echo "name=output_$GITHUB_RUN_ID.json" >> $GITHUB_OUTPUT - # TODO: shoudl we separate adapters and core here? - name: "Get Core Team Membership" run: | gh api -H "Accept: application/vnd.github+json" orgs/dbt-labs/teams/core-group/members > ${{ steps.json_file.outputs.name }} @@ -343,7 +339,7 @@ jobs: fi - name: "Set up Python & Hatch - ${{ env.PYTHON_TARGET_VERSION }}" - uses: ./.github/actions/setup-python-env + uses: ./.github/actions/setup-python-hatch with: python-version: ${{ env.PYTHON_TARGET_VERSION }} @@ -364,14 +360,14 @@ jobs: - name: "Remove Trailing Whitespace Via Pre-commit" continue-on-error: true run: | - pre-commit run trailing-whitespace --files .bumpversion.cfg CHANGELOG.md .changes/* + pre-commit run trailing-whitespace --files dbt_common/__about__.py CHANGELOG.md .changes/* git status # this step will fail on newline errors but also correct them - name: "Removing Extra Newlines Via Pre-commit" continue-on-error: true run: | - pre-commit run end-of-file-fixer --files .bumpversion.cfg CHANGELOG.md .changes/* + pre-commit run end-of-file-fixer --files dbt_common/__about__.py CHANGELOG.md .changes/* git status - name: "Commit & Push Changes" @@ -392,9 +388,6 @@ jobs: runs-on: ubuntu-latest needs: [create-temp-branch, generate-changelog-bump-version] - env: - TOXENV: unit - steps: - name: "Checkout ${{ github.repository }} Branch ${{ needs.create-temp-branch.outputs.branch_name }}" uses: actions/checkout@v3 @@ -402,7 +395,7 @@ jobs: ref: ${{ needs.create-temp-branch.outputs.branch_name }} - name: "Set up Python & Hatch - ${{ env.PYTHON_TARGET_VERSION }}" - uses: ./.github/actions/setup-python-env + uses: ./.github/actions/setup-python-hatch with: python-version: ${{ env.PYTHON_TARGET_VERSION }} @@ -412,10 +405,7 @@ jobs: run-integration-tests: runs-on: ubuntu-20.04 needs: [create-temp-branch, generate-changelog-bump-version] - if: inputs.env_setup_script_path != '' - - env: - TOXENV: integration + if: inputs.run-integration-tests == true steps: - name: "Checkout ${{ github.repository }} Branch ${{ needs.create-temp-branch.outputs.branch_name }}" @@ -424,10 +414,11 @@ jobs: ref: ${{ needs.create-temp-branch.outputs.branch_name }} - name: "Setup Environment Variables - ./${{ inputs.env_setup_script_path }}" + if: inputs.env_setup_script_path != '' run: source ./${{ inputs.env_setup_script_path }} - # TODO: will we still have to do this for dbt-adapter? - name: "Setup Environment Variables - Secrets Context" + if: inputs.env_setup_script_path != '' uses: actions/github-script@v6 id: check-env with: @@ -475,7 +466,6 @@ jobs: steps: - name: "[Debug] Print Variables" run: | - echo target_branch: ${{ inputs.target_branch }} echo branch_name: ${{ needs.create-temp-branch.outputs.branch_name }} echo inputs.test_run: ${{ inputs.test_run }} echo needs.audit-changelog.outputs.exists: ${{ needs.audit-changelog.outputs.exists }} @@ -484,21 +474,21 @@ jobs: - name: "Checkout Repo ${{ github.repository }}" uses: actions/checkout@v3 - - name: "Merge Changes Into ${{ inputs.target_branch }}" + - name: "Merge Changes Into main" uses: everlytic/branch-merge@1.1.5 with: source_ref: ${{ needs.create-temp-branch.outputs.branch_name }} - target_branch: ${{ inputs.target_branch }} + target_branch: "main" github_token: ${{ secrets.FISHTOWN_BOT_PAT }} commit_message_template: "[Automated] Merged {source_ref} into target {target_branch} during release process" - - name: "[Notification] Changes Merged into ${{ inputs.target_branch }}" + - name: "[Notification] Changes Merged into main" run: | title="Changelog and Version Bump Branch Merge" - message="The ${{ needs.create-temp-branch.outputs.branch_name }} branch was merged into ${{ inputs.target_branch }}" + message="The ${{ needs.create-temp-branch.outputs.branch_name }} branch was merged into mains" echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - determine-release-sha: + determine-release-branch: runs-on: ubuntu-latest needs: [ @@ -519,7 +509,6 @@ jobs: steps: - name: "[Debug] Print Variables" run: | - echo target_branch: ${{ inputs.target_branch }} echo new_branch: ${{ needs.create-temp-branch.outputs.branch_name }} echo changelog_exists: ${{ needs.audit-changelog.outputs.exists }} echo up_to_date: ${{ needs.audit-version-in-code.outputs.up_to_date }} @@ -528,11 +517,11 @@ jobs: id: resolve_branch run: | branch="" - if [[ ${{ inputs.test_run == true }} ]] + if [[ ${{ inputs.test_run == true }} or ${{ inputs.nightly_release == true }}]] then branch=${{ needs.create-temp-branch.outputs.branch_name }} else - branch=${{ inputs.target_branch }} + branch="main" fi echo "target_branch=$branch" >> $GITHUB_OUTPUT @@ -550,23 +539,7 @@ jobs: - name: "[Debug] Log Branch" run: git status - - name: "Resolve Commit SHA For Release" - id: resolve_commit_sha - run: | - commit_sha=$(git rev-parse HEAD) - echo "release_sha=$commit_sha" >> $GITHUB_OUTPUT - - - name: "[Notification] Resolve Commit SHA For Release" - run: | - title="Release commit pick" - message="The ${{ steps.resolve_commit_sha.outputs.release_sha }} commit will be used for release" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - - name: "Remove Temp Branch - ${{ needs.create-temp-branch.outputs.branch_name }}" - if: ${{ inputs.test_run == false && needs.create-temp-branch.outputs.branch_name != '' }} + if: ${{ inputs.test_run == false && inputs.nightly_release == false && needs.create-temp-branch.outputs.branch_name != '' }} run: | git push origin -d ${{ needs.create-temp-branch.outputs.branch_name }} - - - name: "[Debug] Print Outputs" - run: | - echo release_sha: ${{ steps.resolve_commit_sha.outputs.release_sha }}