From 70f52df2b108499e54156ab298a3e2cc0786ee2d Mon Sep 17 00:00:00 2001 From: Salomon Popp Date: Wed, 15 Jan 2025 13:39:55 +0100 Subject: [PATCH] Fix CI release and changelog (#590) --- .github/workflows/python-uv-release.yaml | 126 +++++++++++++++++++++++ .github/workflows/release.yaml | 4 +- uv.lock | 2 +- 3 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/python-uv-release.yaml diff --git a/.github/workflows/python-uv-release.yaml b/.github/workflows/python-uv-release.yaml new file mode 100644 index 000000000..13cee8b77 --- /dev/null +++ b/.github/workflows/python-uv-release.yaml @@ -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/checkout@1.49.0 + 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/bump-version@v1.21.2 + with: + release-type: ${{ inputs.release-type }} + working-directory: ${{ inputs.working-directory }} + + - name: Bump version release + id: bump-version + uses: bakdata/ci-templates/actions/bump-version@v1.21.2 + 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/changelog-generate@1.50.0 + 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/commit-and-push@1.25.2 + 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/tag-and-release@v1.22.0 + 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 }}" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d239467c9..f927f1a55 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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: diff --git a/uv.lock b/uv.lock index e1547b870..39fe41a62 100644 --- a/uv.lock +++ b/uv.lock @@ -419,7 +419,7 @@ wheels = [ [[package]] name = "kpops" -version = "9.1.0" +version = "9.2.0.dev0" source = { editable = "." } dependencies = [ { name = "anyio" },