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

Fix CI release and changelog #590

Merged
merged 4 commits into from
Jan 15, 2025
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
126 changes: 126 additions & 0 deletions .github/workflows/python-uv-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Python uv release
# Reusable workflow for building and releasing Python uv packages

on:
workflow_call:
inputs:
release-type:
description: "Scope of the release (major, minor or patch)."
required: true
type: string
uv-version:
description: "The uv version to be installed. (Default is 0.5.14)"
required: false
default: "0.5.14"
type: string
python-version:
description: "The Python version for setting up uv. (Default is 3.11)"
required: false
default: "3.11"
type: string
changelog:
description: "Create changelog for release."
required: false
default: true
type: boolean
changelog-file:
description: Path to the changelog file in the GitHub repository
required: false
default: "CHANGELOG.md"
type: string
changelog-config:
description: "Changelog config path."
required: false
default: ""
type: string
working-directory:
description: "Working directory containing `.bumpversion.cfg`. (Default is .)"
required: false
default: "."
type: string

secrets:
github-username:
description: "The GitHub username for committing the changes."
required: true
github-email:
description: "The GitHub email for committing the changes."
required: true
github-token:
description: "The GitHub token for committing the changes."
required: true

# Map the workflow outputs to job outputs
outputs:
release-version:
description: "The bumped version."
value: ${{ jobs.release.outputs.release-version }}
old-version:
description: "The old version in your `.bumpversion.cfg` file."
value: ${{ jobs.release.outputs.old-version }}

jobs:
release:
runs-on: ubuntu-22.04
# Map the job outputs to step outputs
outputs:
release-version: ${{ steps.bump-version.outputs.release-version }}
old-version: ${{ steps.bump-version.outputs.old-version }}

steps:
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ inputs.python-version }}
version: ${{ inputs.uv-version }}

- name: Check out repository
uses: bakdata/ci-templates/actions/[email protected]
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false # required for pushing to protected branch later
fetch-depth: 0 # required for changelog generation

- name: Bump version
uses: bakdata/ci-templates/actions/[email protected]
with:
release-type: ${{ inputs.release-type }}
working-directory: ${{ inputs.working-directory }}

- name: Bump version release
id: bump-version
uses: bakdata/ci-templates/actions/[email protected]
with:
release-type: release --allow-dirty
working-directory: ${{ inputs.working-directory }}

- name: Apply version bump to uv lock
run: uv lock --no-refresh

- name: Create changelog
id: build-changelog
uses: bakdata/ci-templates/actions/[email protected]
if: ${{ inputs.changelog }}
with:
github-token: ${{ secrets.github-token }}
tag: ${{ steps.bump-version.outputs.release-version }}
changelog-file: ${{ inputs.changelog-file }}

- name: Commit and push changes including .bumpversion.cfg file
uses: bakdata/ci-templates/actions/[email protected]
with:
ref: ${{ github.event.repository.default_branch }}
commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}"
github-username: ${{ secrets.github-username }}
github-email: ${{ secrets.github-email }}
github-token: ${{ secrets.github-token }}

- name: Tag and release
uses: bakdata/ci-templates/actions/[email protected]
with:
tag: "${{ steps.bump-version.outputs.release-version }}"
github-username: ${{ secrets.github-username }}
github-email: ${{ secrets.github-email }}
github-token: ${{ secrets.github-token }}
release-title: "${{ steps.bump-version.outputs.release-version }}"
release-body: "${{ steps.build-changelog.outputs.single-changelog }}"
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ on:

jobs:
create-github-release-push-tag:
uses: bakdata/ci-templates/.github/workflows/bump-version-release.yaml@1.51.0
uses: ./.github/workflows/python-uv-release.yaml
name: Release
with:
release-type: ${{ inputs.release-type }}
python-version: "3.11"
uv-version: "0.5.14"
changelog: true
changelog-file: "./docs/docs/user/changelog.md"
secrets:
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading