merge aws iam user configuration into the integration tests workflow #103
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# **what?** | |
# Release workflow provides the following steps: | |
# - checkout the given commit; | |
# - validate version in sources and changelog file for given version; | |
# - bump the version and generate a changelog if needed; | |
# - merge all changes to the target branch if needed; | |
# - run unit and integration tests against given commit; | |
# - build and package that SHA; | |
# - release it to GitHub and PyPI with that specific build; | |
# | |
# **why?** | |
# Ensure an automated and tested release process | |
# | |
# **when?** | |
# This workflow can be run manually on demand or can be called by other workflows | |
name: "Release pipeline" | |
run-name: "Release `${{ inputs.version }}` to `${{ inputs.deploy-environment }}`" | |
on: | |
workflow_call: | |
inputs: | |
sha: | |
description: "The commit sha to release" | |
type: string | |
required: true | |
branch: | |
description: "The branch to release from" | |
type: string | |
default: "main" | |
version: | |
description: "The release version (e.g. 1.0.0b1)" | |
type: string | |
required: true | |
deploy-environment: | |
description: "Where to publish" | |
type: string | |
default: "prod" | |
publish-slack-override: | |
description: "Use to publish a Slack notification for non-prod deploy environments" | |
type: boolean | |
default: false | |
workflow_dispatch: | |
inputs: | |
sha: | |
description: "The commit sha to release" | |
type: string | |
required: true | |
branch: | |
description: "The branch to release from" | |
type: string | |
default: "main" | |
version: | |
description: "The release version (e.g. 1.0.0b1)" | |
type: string | |
required: true | |
deploy-environment: | |
description: "Where to publish" | |
type: environment | |
publish-slack-override: | |
description: "Use to publish a Slack notification for non-prod deploy environments" | |
type: boolean | |
default: false | |
# this is the permission that allows creating a new release to both GitHub and PyPI | |
permissions: | |
contents: write | |
id-token: write | |
# deploying the same version of a package to the same environment should override any previous deployment with those attributes | |
concurrency: | |
group: "${{ github.workflow }}-${{ inputs.version }}-${{ inputs.deploy-environment }}" | |
cancel-in-progress: true | |
jobs: | |
release-inputs: | |
name: "Release inputs" | |
runs-on: ubuntu-latest | |
outputs: | |
archive-name: ${{ steps.computed-inputs.outputs.archive-name }} | |
steps: | |
- name: "Set: archive name" | |
id: archive | |
shell: bash | |
run: | | |
archive_name=${{ inputs.package }}-${{ inputs.version_number }}-${{ inputs.deploy-environment }} | |
echo "name=$archive_name" >> $GITHUB_OUTPUT | |
- name: "[DEBUG] Inputs" | |
shell: bash | |
run: | | |
echo branch : ${{ inputs.branch }} | |
echo package : ${{ inputs.package }} | |
echo version : ${{ inputs.version }} | |
echo deploy-environment : ${{ inputs.deploy-environment }} | |
echo archive-name : ${{ steps.archive.outputs.name }} | |
echo dbt-adapters-branch : ${{ inputs.dbt-adapters-branch }} | |
echo dbt-common-branch : ${{ inputs.dbt-common-branch }} | |
echo dbt-core-branch : ${{ inputs.dbt-core-branch }} | |
release-branch: | |
name: "Create a release branch" | |
needs: release-inputs | |
runs-on: ubuntu-latest | |
outputs: | |
branch: ${{ steps.branch.outputs.branch-name }} | |
steps: | |
- name: "Checkout `${{ inputs.branch }}`" | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- name: "Create release branch" | |
id: branch | |
uses: dbt-labs/actions/create-temp-branch@add-hatch-actions | |
with: | |
branch-stub: "release/${{ inputs.version }}/" | |
bump-version: | |
name: "Bump version" | |
needs: release-branch | |
uses: dbt-labs/actions/.github/workflows/build-bump-version.yml@add-hatch-actions | |
with: | |
branch: ${{ needs.release-branch.outputs.branch }} | |
version: ${{ inputs.version }} | |
secrets: inherit | |
changelog: | |
name: "Generate a new changelog" | |
needs: | |
- release-branch | |
- bump-version | |
uses: dbt-labs/actions/.github/workflows/build-changelog.yml@add-hatch-actions | |
with: | |
branch: ${{ needs.release-branch.outputs.branch }} | |
version: ${{ inputs.version }} | |
secrets: inherit | |
ci-test-suite: | |
name: "Run code quality, unit tests, and integration tests, and build artifacts" | |
needs: | |
- release-inputs | |
- release-branch | |
- version-bump | |
- changelog | |
uses: ./.github/workflows/ci-test-suite.yml | |
with: | |
ref: ${{ needs.release-branch.outputs.branch }} | |
archive-name: ${{ needs.release-inputs.outputs.archive-name }} | |
merge-changes: | |
name: "Merge the version bump and changelog updates" | |
needs: | |
- ci-test-suite | |
- release-branch | |
runs-on: ubuntu-latest | |
outputs: | |
sha: ${{ steps.merge.outputs.sha }} || ${{ steps.merge-test.outputs.sha }} ) | |
steps: | |
- name: "Checkout `${{ needs.release-branch.outputs.branch }}`" | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.release-branch.outputs.branch }} | |
- name: "Merge `${{ needs.release-branch.outputs.branch }}` into `${{ inputs.branch }}`" | |
if: ${{ inputs.deploy-environment == 'prod' }} | |
id: merge | |
uses: dbt-labs/actions/github-merge@add-hatch-actions | |
with: | |
source-branch: ${{ needs.release-branch.outputs.branch }} | |
target-branch: ${{ inputs.branch }} | |
message: "merge {source_ref} into {target_branch} for a release" | |
- name: "Get HEAD SHA for test release" | |
id: merge-test | |
if: ${{ !(inputs.deploy-environment == 'prod') }} | |
shell: bash | |
run: | | |
git pull | |
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
publish-github: | |
name: "Publish to GitHub" | |
if: ${{ !failure() && !cancelled() }} | |
needs: | |
- release-inputs | |
- changelog | |
- merge-changes | |
uses: dbt-labs/actions/.github/workflows/publish-github.yml@add-hatch-actions | |
with: | |
archive-name: ${{ needs.release-inputs.outputs.archive-name }} | |
version: ${{ inputs.version }} | |
deploy-environment: ${{ inputs.deploy-environment }} | |
sha: ${{ needs.merge-changes.outputs.sha }} | |
changelog-path: ${{ needs.changelog.outputs.changelog-path }} | |
publish-pypi: | |
name: "Publish to PyPI" | |
needs: | |
- release-inputs | |
- merge-changes | |
if: ${{ !failure() && !cancelled() }} | |
environment: | |
name: ${{ inputs.deploy-environment }} | |
url: ${{ vars.PYPI_PROJECT_URL }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Publish to PyPI" | |
uses: .github/actions/publish-pypi | |
with: | |
repository-url: ${{ vars.PYPI_REPOSITORY_URL }} | |
archive-name: ${{ inputs.archive-name }} | |
publish-pypi-internal: | |
name: "Publish to internal PyPI" | |
if: ${{ !failure() && !cancelled() }} | |
needs: | |
- release-inputs | |
- merge-changes | |
uses: dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@main | |
with: | |
version_number: "${{ inputs.version }}" | |
package_test_command: "python -c \"import dbt.adapters.redshift\"" | |
dbms_name: "redshift" | |
ref: ${{ needs.merge-changes.outputs.sha }} | |
secrets: inherit | |
slack-notification: | |
name: "Slack notification" | |
if: >- | |
failure() && | |
( | |
inputs.deploy-environment == 'prod' || | |
inputs.publish-slack-override | |
) | |
needs: | |
- 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_ADAPTER_ALERTS }} |