Release 1.9.0rc1 to GitHub, PyPI, and Docker #130
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; | |
# - run unit 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 will only run manually. Run this workflow only after the | |
# version bump workflow is completed and related changes are reviewed and merged. | |
# | |
name: "Release to GitHub, PyPI, and Docker" | |
run-name: "Release ${{ inputs.version_number }} to GitHub, PyPI, and Docker" | |
on: | |
workflow_dispatch: | |
inputs: | |
sha: | |
description: "The last commit sha in the release" | |
type: string | |
required: true | |
target_branch: | |
description: "The branch to release from" | |
type: string | |
required: true | |
version_number: | |
description: "The release version number (i.e. 1.0.0b1)" | |
type: string | |
required: true | |
build_script_path: | |
description: "Build script path" | |
type: string | |
default: "scripts/build-dist.sh" | |
required: true | |
s3_bucket_name: | |
description: "AWS S3 bucket name" | |
type: string | |
default: "core-team-artifacts" | |
required: true | |
package_test_command: | |
description: "Package test command" | |
type: string | |
default: "python -c \"import dbt.adapters.spark\"" | |
required: true | |
env_setup_script_path: | |
description: "Environment setup script path" | |
type: string | |
default: "" | |
required: false | |
test_run: | |
description: "Test run (Publish release as draft)" | |
type: boolean | |
default: true | |
required: false | |
nightly_release: | |
description: "Nightly release to dev environment" | |
type: boolean | |
default: false | |
required: false | |
only_docker: | |
description: "Only release Docker image, skip GitHub & PyPI" | |
type: boolean | |
default: false | |
required: false | |
permissions: | |
contents: write # this is the permission that allows creating a new release | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
log-inputs: | |
name: "Log Inputs" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "[DEBUG] Print Variables" | |
run: | | |
echo The last commit sha in the release: ${{ inputs.sha }} | |
echo The branch to release from: ${{ inputs.target_branch }} | |
echo The release version number: ${{ inputs.version_number }} | |
echo Build script path: ${{ inputs.build_script_path }} | |
echo Environment setup script path: ${{ inputs.env_setup_script_path }} | |
echo AWS S3 bucket name: ${{ inputs.s3_bucket_name }} | |
echo Package test command: ${{ inputs.package_test_command }} | |
echo Test run: ${{ inputs.test_run }} | |
echo Only Docker: ${{ inputs.only_docker }} | |
bump-version-generate-changelog: | |
name: Bump package version, Generate changelog | |
uses: dbt-labs/dbt-release/.github/workflows/release-prep.yml@removeSparkException | |
with: | |
sha: ${{ inputs.sha }} | |
version_number: ${{ inputs.version_number }} | |
target_branch: ${{ inputs.target_branch }} | |
env_setup_script_path: ${{ inputs.env_setup_script_path }} | |
test_run: ${{ inputs.test_run }} | |
nightly_release: ${{ inputs.nightly_release }} | |
secrets: inherit | |
log-outputs-bump-version-generate-changelog: | |
name: "[Log output] Bump package version, Generate changelog" | |
if: ${{ !failure() && !cancelled() && !inputs.only_docker }} | |
needs: [bump-version-generate-changelog] | |
runs-on: ubuntu-latest | |
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 }} | |
build-test-package: | |
name: "Build, Test, Package" | |
if: ${{ !failure() && !cancelled() && !inputs.only_docker }} | |
needs: [bump-version-generate-changelog] | |
uses: dbt-labs/dbt-release/.github/workflows/build.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 }} | |
build_script_path: ${{ inputs.build_script_path }} | |
s3_bucket_name: ${{ inputs.s3_bucket_name }} | |
package_test_command: ${{ inputs.package_test_command }} | |
test_run: ${{ inputs.test_run }} | |
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() && !inputs.only_docker }} | |
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 }} | |
pypi-release: | |
name: "PyPI Release" | |
if: ${{ !failure() && !cancelled() && !inputs.only_docker }} | |
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 }} | |
docker-release: | |
name: "Docker Release" | |
# We cannot release to docker on a test run because it uses the tag in GitHub as | |
# what we need to release but draft releases don't actually tag the commit so it | |
# finds nothing to release | |
if: ${{ !failure() && !cancelled() && (!inputs.test_run || inputs.only_docker) }} | |
needs: [github-release] | |
permissions: | |
packages: write | |
uses: dbt-labs/dbt-release/.github/workflows/release-docker.yml@main | |
with: | |
version_number: ${{ inputs.version_number }} | |
dockerfile: "docker/Dockerfile" | |
test_run: ${{ inputs.test_run }} | |
slack-notification: | |
name: Slack Notification | |
if: ${{ failure() && (!inputs.test_run || inputs.nightly_release) }} | |
needs: | |
[ | |
github-release, | |
pypi-release, | |
docker-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 }} |