Skip to content

Commit 61009f6

Browse files
authored
Tweak release for unused fields (#12209)
* point to branch: * remove unused code paths * make release backwards compatible hardcode * use correct types * put main back
1 parent ee7ecdc commit 61009f6

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ defaults:
7272
run:
7373
shell: bash
7474

75+
env:
76+
MIN_HATCH_VERSION: "1.11.0"
77+
7578
jobs:
7679
job-setup:
7780
name: Log Inputs
7881
runs-on: ${{ vars.UBUNTU_LATEST }}
7982
outputs:
80-
starting_sha: ${{ steps.set_sha.outputs.starting_sha }}
83+
use_hatch: ${{ steps.use_hatch.outputs.use_hatch }}
8184
steps:
8285
- name: "[DEBUG] Print Variables"
8386
run: |
@@ -88,19 +91,29 @@ jobs:
8891
echo Nightly release: ${{ inputs.nightly_release }}
8992
echo Only Docker: ${{ inputs.only_docker }}
9093
91-
- name: "Checkout target branch"
92-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # actions/checkout@v4
93-
with:
94-
ref: ${{ inputs.target_branch }}
95-
96-
# release-prep.yml really shouldn't take in the sha but since core + all adapters
97-
# depend on it now this workaround lets us not input it manually with risk of error.
98-
# The changes always get merged into the head so we can't use a specific commit for
99-
# releases anyways.
100-
- name: "Capture sha"
101-
id: set_sha
94+
# In version env.HATCH_VERSION we started to use hatch for build tooling. Before that we used setuptools.
95+
# This needs to check if we're using hatch or setuptools based on the version being released. We should
96+
# check if the version is greater than or equal to env.HATCH_VERSION. If it is, we use hatch, otherwise we use setuptools.
97+
- name: "Check if using hatch"
98+
id: use_hatch
10299
run: |
103-
echo "starting_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
100+
# Extract major.minor from versions like 1.11.0a1 -> 1.11
101+
INPUT_MAJ_MIN=$(echo "${{ inputs.version_number }}" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
102+
HATCH_MAJ_MIN=$(echo "${{ env.MIN_HATCH_VERSION }}" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
103+
104+
if [ $(echo "$INPUT_MAJ_MIN >= $HATCH_MAJ_MIN" | bc) -eq 1 ]; then
105+
echo "use_hatch=true" >> $GITHUB_OUTPUT
106+
else
107+
echo "use_hatch=false" >> $GITHUB_OUTPUT
108+
fi
109+
110+
- name: "Notify if using hatch"
111+
run: |
112+
if [ ${{ steps.use_hatch.outputs.use_hatch }} = "true" ]; then
113+
echo "::notice title="Using Hatch": $title::Using Hatch for release"
114+
else
115+
echo "::notice title="Using Setuptools": $title::Using Setuptools for release"
116+
fi
104117
105118
bump-version-generate-changelog:
106119
name: Bump package version, Generate changelog
@@ -110,12 +123,13 @@ jobs:
110123
uses: dbt-labs/dbt-release/.github/workflows/release-prep.yml@main
111124

112125
with:
113-
sha: ${{ needs.job-setup.outputs.starting_sha }}
114126
version_number: ${{ inputs.version_number }}
127+
hatch_directory: "core"
115128
target_branch: ${{ inputs.target_branch }}
116129
env_setup_script_path: "scripts/env-setup.sh"
117130
test_run: ${{ inputs.test_run }}
118131
nightly_release: ${{ inputs.nightly_release }}
132+
use_hatch: ${{ needs.job-setup.outputs.use_hatch == 'true' }} # workflow outputs are strings...
119133

120134
secrets: inherit
121135

@@ -143,16 +157,13 @@ jobs:
143157
with:
144158
sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }}
145159
version_number: ${{ inputs.version_number }}
160+
hatch_directory: "core"
146161
changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }}
147162
build_script_path: "scripts/build-dist.sh"
148-
s3_bucket_name: "core-team-artifacts"
149163
package_test_command: "dbt --version"
150164
test_run: ${{ inputs.test_run }}
151165
nightly_release: ${{ inputs.nightly_release }}
152-
153-
secrets:
154-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
155-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
166+
use_hatch: ${{ needs.job-setup.outputs.use_hatch == 'true' }} # workflow outputs are strings...
156167

157168
github-release:
158169
name: GitHub Release

0 commit comments

Comments
 (0)