From 74f7e843130c47d9b64f8b2e01dd519bf0bb1f13 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Tue, 23 Jan 2024 12:31:12 -0600 Subject: [PATCH] simplify release inputs --- .github/workflows/release.yml | 94 +++++++++++++---------------------- 1 file changed, 35 insertions(+), 59 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3722ea19cd..254e92aa0a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,10 +19,6 @@ name: Release to GitHub and PyPI 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 @@ -31,26 +27,6 @@ on: 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 - env_setup_script_path: - description: "Environment setup script path" - type: string - default: "scripts/env-setup.sh" - required: false - 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: "dbt --version" - required: true test_run: description: "Test run (Publish release as draft)" type: boolean @@ -63,10 +39,6 @@ on: required: false workflow_call: inputs: - sha: - description: "The last commit sha in the release" - type: string - required: true target_branch: description: "The branch to release from" type: string @@ -75,26 +47,6 @@ on: 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 - env_setup_script_path: - description: "Environment setup script path" - type: string - default: "scripts/env-setup.sh" - required: false - 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: "dbt --version" - required: true test_run: description: "Test run (Publish release as draft)" type: boolean @@ -113,33 +65,57 @@ defaults: run: shell: bash +env: + build_script_path: "scripts/build-dist.sh" + env_setup_script_path: "scripts/env-setup.sh" + s3_bucket_name: "core-team-artifacts" + package_test_command: "dbt --version" + jobs: - log-inputs: + job-setup: name: Log Inputs runs-on: ubuntu-latest + outputs: + starting_sha: ${{ steps.set_path.outputs.changelog_path }} steps: - name: "[DEBUG] Print Variables" run: | - echo The last commit sha in the release: ${{ inputs.sha }} + echo Inputs 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 Nightly release: ${{ inputs.nightly_release }} + echo Env vars + echo Build script path: ${{ env.build_script_path }} + 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: "Checkout target branch" + uses: actions/checkout@v4 + with: + ref: ${{ inputs.target_branch }} + + # release-prep.yml really shouldn't take in the sha but since core + all adapters + # depend on it now this workaround lets us not input it manually with risk of error. + # The changes always get merged into the head so we can't use a specific commit fo + # releases anyways. + - name: "Capture sha" + id: set_path + run: | + echo "starting_sha=$(git rev-parse HEAD) >> $GITHUB_OUTPUT bump-version-generate-changelog: name: Bump package version, Generate changelog + needs: [job-setup] uses: dbt-labs/dbt-release/.github/workflows/release-prep.yml@main with: - sha: ${{ inputs.sha }} + sha: ${{ needs.job-setup.outputs.starting_sha }} version_number: ${{ inputs.version_number }} target_branch: ${{ inputs.target_branch }} - env_setup_script_path: ${{ inputs.env_setup_script_path }} + env_setup_script_path: ${{ env.env_setup_script_path }} test_run: ${{ inputs.test_run }} nightly_release: ${{ inputs.nightly_release }} @@ -170,9 +146,9 @@ jobs: 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 }} + build_script_path: ${{ env.build_script_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 }}