Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version bump and changelogs to full release #233

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 "[email protected]"

- 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 "[email protected]"

- name: "Add Homebrew To PATH"
run: |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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'
Expand All @@ -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 "[email protected]"

- 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 "[email protected]"

- name: "Merge in changes"
run: |
git fetch origin ${{ needs.create-temp-branch.outputs.branch_name }}
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand 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:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading