diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml index 80c991a..e374d8f 100644 --- a/.github/workflows/pre_release.yml +++ b/.github/workflows/pre_release.yml @@ -29,14 +29,22 @@ name: Version Bump and Changelog Generation run-name: "${{ inputs.version_number }} - Version Bump and Changelog Generation" on: + workflow_call: + inputs: + version_number: + description: "Version to bump to: ex. 1.14.5" + required: true + type: string workflow_dispatch: inputs: version_number: + description: "Version to bump to: ex. 1.14.5" required: true type: string test_run: + description: "Test run - do not commit changes" required: false - default: true + default: false type: boolean permissions: @@ -210,7 +218,7 @@ jobs: id: variables run: | name="prep-release/" - if [[ ${{ inputs.test_run }} == true ]] + if [[ "${{ inputs.test_run }}" == "true" ]] then name+="test-run/" fi @@ -238,16 +246,16 @@ jobs: needs: [audit-changelog, audit-version-in-code, create-temp-branch] steps: - - name: "Set Git User" - run: | - git config user.name "Github Build Bot" - git config user.email "buildbot@fishtownanalytics.com" - - name: "Checkout ${{ github.repository }} Branch ${{ needs.create-temp-branch.outputs.branch_name }}" uses: actions/checkout@v4 with: ref: ${{ needs.create-temp-branch.outputs.branch_name }} + - name: "Set Git User" + run: | + git config user.name "Github Build Bot" + git config user.email "buildbot@fishtownanalytics.com" + - name: "Add Homebrew To PATH" run: | echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH @@ -328,13 +336,13 @@ jobs: # this step will fail on whitespace errors but also correct them, so add a `| true` to avoid failure - name: "Remove Trailing Whitespace Via Pre-commit" run: | - pre-commit run trailing-whitespace --files .bumpversion.cfg CHANGELOG.md .changes/* | true + pre-commit run trailing-whitespace --files .bumpversion.cfg CHANGELOG.md .changes/* || true git status # this step will fail on newline errors but also correct them, so add a `| true` to avoid failure - name: "Removing Extra Newlines Via Pre-commit" run: | - pre-commit run end-of-file-fixer --files .bumpversion.cfg CHANGELOG.md .changes/* | true + pre-commit run end-of-file-fixer --files .bumpversion.cfg CHANGELOG.md .changes/* || true git status - name: "Commit & Push Changes" @@ -374,7 +382,7 @@ jobs: needs: [run-unit-tests, create-temp-branch, audit-version-in-code, audit-changelog] if: | !failure() && !cancelled() && - inputs.test_run == false && + inputs.test_run != true && ( needs.audit-changelog.outputs.exists == 'false' || needs.audit-version-in-code.outputs.up_to_date == 'false' @@ -388,17 +396,17 @@ jobs: echo needs.audit-changelog.outputs.exists: ${{ needs.audit-changelog.outputs.exists }} echo needs.audit-version-in-code.outputs.up_to_date: ${{ needs.audit-version-in-code.outputs.up_to_date }} - - name: "Set Git User" - run: | - git config user.name "Github Build Bot" - git config user.email "buildbot@fishtownanalytics.com" - - name: "Checkout Repo ${{ github.repository }}" uses: actions/checkout@v4 with: ref: ${{ github.ref }} token: ${{ secrets.FISHTOWN_BOT_PAT }} + - name: "Set Git User" + run: | + git config user.name "Github Build Bot" + git config user.email "buildbot@fishtownanalytics.com" + - name: "Merge in changes" run: | git fetch origin ${{ needs.create-temp-branch.outputs.branch_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad581c9..bef42a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,13 +3,17 @@ name: Release on: workflow_dispatch: inputs: + version_number: + description: "Version to bump to: ex. 1.14.5" + required: true + type: string deploy-to: type: choice description: Choose where to publish (test/prod) options: - PypiProd - PypiTest - default: PypiTest + default: PypiProd permissions: read-all @@ -23,10 +27,20 @@ concurrency: cancel-in-progress: true jobs: + release-prep: + permissions: + contents: write + name: "Version bump and Changelog update" + uses: ./.github/workflows/pre_release.yml + with: + version_number: ${{ inputs.version_number }} + secrets: + inherit release: name: PyPI - ${{ inputs.deploy-to }} runs-on: ubuntu-latest + needs: release-prep environment: name: ${{ inputs.deploy-to }} permissions: diff --git a/README.md b/README.md index dbdf144..0c94c57 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,7 @@ The shared common utilities for dbt-core and adapter implementations use ### Releasing dbt-common To release a new version of dbt-common to pypi, you'll need to: -1. Bump the `version` in [dbt_common_/__about__.py](https://github.com/dbt-labs/dbt-common/blob/main/dbt_common/__about__.py) -2. Run the [release workflow](https://github.com/dbt-labs/dbt-common/actions/workflows/release.yml) to test pypi and confirm a successful test release in: https://test.pypi.org/project/dbt-common/ -3. Run the [release workflow](https://github.com/dbt-labs/dbt-common/actions/workflows/release.yml) to prod pypi and confirm a successful release in: https://pypi.org/project/dbt-common/ +1. Run the [release workflow](https://github.com/dbt-labs/dbt-common/actions/workflows/release.yml) to bump the version, generate changelogs and release to pypi 4. Bump the version of `dbt-common` in `dbt-core` and `dbt-adapters` if you're releasing a new major version or a pre-release: * `dbt-core`: [setup.py](https://github.com/dbt-labs/dbt-core/blob/main/core/setup.py) * `dbt-adapters`: [pyproject.toml](https://github.com/dbt-labs/dbt-adapters/blob/main/pyproject.toml)