From 0375c17513c8ee9b332adf81f0c9d63757eab888 Mon Sep 17 00:00:00 2001 From: "stoyan.yordanov" Date: Tue, 29 Aug 2023 12:39:27 +0300 Subject: [PATCH 01/32] commit-message --- .../bump-version-release-stoyan.yaml | 113 ++++++++++++++++++ actions/bump-version-stoyan/action.yaml | 48 ++++++++ actions/patch-snapshot/action.yaml | 32 +++++ 3 files changed, 193 insertions(+) create mode 100644 .github/workflows/bump-version-release-stoyan.yaml create mode 100644 actions/bump-version-stoyan/action.yaml create mode 100644 actions/patch-snapshot/action.yaml diff --git a/.github/workflows/bump-version-release-stoyan.yaml b/.github/workflows/bump-version-release-stoyan.yaml new file mode 100644 index 000000000..9183d2334 --- /dev/null +++ b/.github/workflows/bump-version-release-stoyan.yaml @@ -0,0 +1,113 @@ +name: Bump Version Release +# Reusable workflow for creating release tags using bumpversion + +on: + workflow_call: + inputs: + release-type: + description: "Scope of the release (major, minor or patch)." + required: true + type: string + changelog: + description: "Create changelog for release." + required: false + default: false + type: boolean + changelog-config: + description: "Changelog config path." + required: false + 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: Check out repository + uses: actions/checkout@v3 + with: + ref: ${{ github.event.repository.default_branch }} + persist-credentials: false # required for pushing to protected branch later + + - name: Bump version + id: bump-version + uses: bakdata/ci-templates/actions/bump-version-stoyan@feat/new-bumpversion + with: + release-type: ${{ inputs.release-type }} + working-directory: ${{ inputs.working-directory }} + + - name: Commit and push changes including .bumpversion.cfg file + uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 + 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: Create changelog + id: build-changelog + uses: bakdata/ci-templates/actions/changelog-generate@1.25.4 + if: ${{ inputs.changelog == 'true' }} + with: + github-token: ${{ secrets.github-token }} + config: ${{ inputs.changelog-config }} + new-tag: ${{ steps.bump-version.outputs.release-version }} + fetch-reviewers: "true" + fetch-release-information: "true" + + - 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 }}" + + - name: Bump version + id: bump-version-2 + uses: bakdata/ci-templates/actions/patch-snapshot@feat/new-bumpversion + with: + working-directory: ${{ inputs.working-directory }} + test-version: ${{ steps.bump-version.outputs.release-version }} + + - name: Commit and push changes including .bumpversion.cfg file + uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 + with: + ref: ${{ github.event.repository.default_branch }} + commit-message: "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-2.outputs.release-version }}" + github-username: ${{ secrets.github-username }} + github-email: ${{ secrets.github-email }} + github-token: ${{ secrets.github-token }} diff --git a/actions/bump-version-stoyan/action.yaml b/actions/bump-version-stoyan/action.yaml new file mode 100644 index 000000000..3a9af886e --- /dev/null +++ b/actions/bump-version-stoyan/action.yaml @@ -0,0 +1,48 @@ +name: "Bump version" +description: "Bump version with python bump2version using .bumpversion.cfg" + +inputs: + release-type: + description: "The type of the release (major, minor or patch)." + required: true + working-directory: + description: "The directory containing the `.bumpversion.cfg` file." + required: false + default: "." + new-version: + description: "" + required: false + default: "" + +outputs: + release-version: + description: "The bumped version of your project." + value: ${{ steps.bump-version.outputs.new-version }} + old-version: + description: "The old version in your `.bumpversion.cfg` file." + value: ${{ steps.bump-version.outputs.old-version }} + +runs: + using: "composite" + steps: + - name: Set up bump2version + run: | + pipx install bump2version + shell: bash + + - name: Bump version + id: bump-version + run: | + parameters=(--no-commit --allow-dirty --no-tag ${{ inputs.release-type }}) + test=(${{ inputs.release-type }}) + echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" + if [[ $test == patch ]]; then + parameters+=(--new-version ${{ inputs.new-version }}) + bump2version --allow-dirty release + else + bump2version --allow-dirty "${parameters[@]}" + bump2version --allow-dirty release + fi + echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" + shell: bash + working-directory: ${{ inputs.working-directory }} diff --git a/actions/patch-snapshot/action.yaml b/actions/patch-snapshot/action.yaml new file mode 100644 index 000000000..d588e973a --- /dev/null +++ b/actions/patch-snapshot/action.yaml @@ -0,0 +1,32 @@ +name: "Snapshot Patch for Bump Version" +description: "Patch version for snapshot" + +inputs: + working-directory: + description: "The directory containing the `.bumpversion.cfg` file." + required: false + default: "." +outputs: + release-version: + description: "The bumped version of your project." + value: ${{ steps.bump-version.outputs.new-version }} + old-version: + description: "The old version in your `.bumpversion.cfg` file." + value: ${{ steps.bump-version.outputs.old-version }} + +runs: + using: "composite" + steps: + - name: Set up bumpversion + run: | + pipx install bump2version + shell: bash + + - name: Bump version + id: bump-version + run: | + echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" + bump2version --allow-dirty patch + echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" + shell: bash + working-directory: ${{ inputs.working-directory }} From a0416c6bd531f8e2dfb8948e88d34dce80ebc549 Mon Sep 17 00:00:00 2001 From: "stoyan.yordanov" Date: Tue, 29 Aug 2023 13:24:15 +0300 Subject: [PATCH 02/32] commit-message --- .github/workflows/bump-version-release-stoyan.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-version-release-stoyan.yaml b/.github/workflows/bump-version-release-stoyan.yaml index 9183d2334..1bc02b414 100644 --- a/.github/workflows/bump-version-release-stoyan.yaml +++ b/.github/workflows/bump-version-release-stoyan.yaml @@ -97,7 +97,7 @@ jobs: release-body: "${{ steps.build-changelog.outputs.single-changelog }}" - name: Bump version - id: bump-version-2 + id: bump-version-snapshot uses: bakdata/ci-templates/actions/patch-snapshot@feat/new-bumpversion with: working-directory: ${{ inputs.working-directory }} @@ -107,7 +107,7 @@ jobs: uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 with: ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-2.outputs.release-version }}" + commit-message: "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" github-username: ${{ secrets.github-username }} github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} From 82db094b438be36bec2b93bae0d94bb739ca0737 Mon Sep 17 00:00:00 2001 From: "stoyan.yordanov" Date: Tue, 29 Aug 2023 15:25:51 +0300 Subject: [PATCH 03/32] commit-message --- .github/workflows/bump-version-release-stoyan.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-version-release-stoyan.yaml b/.github/workflows/bump-version-release-stoyan.yaml index 1bc02b414..e2fbd1518 100644 --- a/.github/workflows/bump-version-release-stoyan.yaml +++ b/.github/workflows/bump-version-release-stoyan.yaml @@ -107,7 +107,7 @@ jobs: uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 with: ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" github-username: ${{ secrets.github-username }} github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} From 99c497133d26e64a35057c63f96b3dc3ac4b7445 Mon Sep 17 00:00:00 2001 From: "stoyan.yordanov" Date: Thu, 31 Aug 2023 09:23:26 +0300 Subject: [PATCH 04/32] commit-message --- .../bump-version-release-stoyan.yaml | 113 ------------------ .github/workflows/bump-version-release.yaml | 36 ++++-- actions/bump-version-stoyan/action.yaml | 48 -------- actions/bump-version/action.yaml | 10 +- 4 files changed, 33 insertions(+), 174 deletions(-) delete mode 100644 .github/workflows/bump-version-release-stoyan.yaml delete mode 100644 actions/bump-version-stoyan/action.yaml diff --git a/.github/workflows/bump-version-release-stoyan.yaml b/.github/workflows/bump-version-release-stoyan.yaml deleted file mode 100644 index e2fbd1518..000000000 --- a/.github/workflows/bump-version-release-stoyan.yaml +++ /dev/null @@ -1,113 +0,0 @@ -name: Bump Version Release -# Reusable workflow for creating release tags using bumpversion - -on: - workflow_call: - inputs: - release-type: - description: "Scope of the release (major, minor or patch)." - required: true - type: string - changelog: - description: "Create changelog for release." - required: false - default: false - type: boolean - changelog-config: - description: "Changelog config path." - required: false - 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: Check out repository - uses: actions/checkout@v3 - with: - ref: ${{ github.event.repository.default_branch }} - persist-credentials: false # required for pushing to protected branch later - - - name: Bump version - id: bump-version - uses: bakdata/ci-templates/actions/bump-version-stoyan@feat/new-bumpversion - with: - release-type: ${{ inputs.release-type }} - working-directory: ${{ inputs.working-directory }} - - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 - 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: Create changelog - id: build-changelog - uses: bakdata/ci-templates/actions/changelog-generate@1.25.4 - if: ${{ inputs.changelog == 'true' }} - with: - github-token: ${{ secrets.github-token }} - config: ${{ inputs.changelog-config }} - new-tag: ${{ steps.bump-version.outputs.release-version }} - fetch-reviewers: "true" - fetch-release-information: "true" - - - 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 }}" - - - name: Bump version - id: bump-version-snapshot - uses: bakdata/ci-templates/actions/patch-snapshot@feat/new-bumpversion - with: - working-directory: ${{ inputs.working-directory }} - test-version: ${{ steps.bump-version.outputs.release-version }} - - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 - with: - ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" - github-username: ${{ secrets.github-username }} - github-email: ${{ secrets.github-email }} - github-token: ${{ secrets.github-token }} diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index a891d118e..0416d89f5 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -61,11 +61,20 @@ jobs: - name: Bump version id: bump-version - uses: bakdata/ci-templates/actions/bump-version@v1.21.2 + uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion with: release-type: ${{ inputs.release-type }} working-directory: ${{ inputs.working-directory }} + - name: Commit and push changes including .bumpversion.cfg file + uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 + 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: Create changelog id: build-changelog uses: bakdata/ci-templates/actions/changelog-generate@1.35.0 @@ -77,15 +86,6 @@ jobs: fetch-reviewers: "true" fetch-release-information: "true" - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 - 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: @@ -95,3 +95,19 @@ jobs: github-token: ${{ secrets.github-token }} release-title: "${{ steps.bump-version.outputs.release-version }}" release-body: "${{ steps.build-changelog.outputs.single-changelog }}" + + - name: Bump version + id: bump-version-snapshot + uses: bakdata/ci-templates/actions/patch-snapshot@feat/new-bumpversion + with: + working-directory: ${{ inputs.working-directory }} + test-version: ${{ steps.bump-version.outputs.release-version }} + + - name: Commit and push changes including .bumpversion.cfg file + uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 + with: + ref: ${{ github.event.repository.default_branch }} + commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + github-username: ${{ secrets.github-username }} + github-email: ${{ secrets.github-email }} + github-token: ${{ secrets.github-token }} diff --git a/actions/bump-version-stoyan/action.yaml b/actions/bump-version-stoyan/action.yaml deleted file mode 100644 index 3a9af886e..000000000 --- a/actions/bump-version-stoyan/action.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: "Bump version" -description: "Bump version with python bump2version using .bumpversion.cfg" - -inputs: - release-type: - description: "The type of the release (major, minor or patch)." - required: true - working-directory: - description: "The directory containing the `.bumpversion.cfg` file." - required: false - default: "." - new-version: - description: "" - required: false - default: "" - -outputs: - release-version: - description: "The bumped version of your project." - value: ${{ steps.bump-version.outputs.new-version }} - old-version: - description: "The old version in your `.bumpversion.cfg` file." - value: ${{ steps.bump-version.outputs.old-version }} - -runs: - using: "composite" - steps: - - name: Set up bump2version - run: | - pipx install bump2version - shell: bash - - - name: Bump version - id: bump-version - run: | - parameters=(--no-commit --allow-dirty --no-tag ${{ inputs.release-type }}) - test=(${{ inputs.release-type }}) - echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - if [[ $test == patch ]]; then - parameters+=(--new-version ${{ inputs.new-version }}) - bump2version --allow-dirty release - else - bump2version --allow-dirty "${parameters[@]}" - bump2version --allow-dirty release - fi - echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - shell: bash - working-directory: ${{ inputs.working-directory }} diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index a6bea5a61..3a9af886e 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -33,12 +33,16 @@ runs: - name: Bump version id: bump-version run: | - parameters=(--no-commit --no-tag ${{ inputs.release-type }}) + parameters=(--no-commit --allow-dirty --no-tag ${{ inputs.release-type }}) + test=(${{ inputs.release-type }}) echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - if [ -n "${{ inputs.new-version }}" ]; then + if [[ $test == patch ]]; then parameters+=(--new-version ${{ inputs.new-version }}) + bump2version --allow-dirty release + else + bump2version --allow-dirty "${parameters[@]}" + bump2version --allow-dirty release fi - bump2version "${parameters[@]}" echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" shell: bash working-directory: ${{ inputs.working-directory }} From 78b45d4fc1674515c942d444ce252270dc566fab Mon Sep 17 00:00:00 2001 From: yordanovsstoyan Date: Tue, 3 Oct 2023 12:58:45 +0300 Subject: [PATCH 05/32] reboot --- actions/bump-version/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index 3a9af886e..85405cb80 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -44,5 +44,6 @@ runs: bump2version --allow-dirty release fi echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" + # We use the case for release-type "patch", because if we do not we get inproper results. For example : 0.0.1-snapshot -> 0.0.3 shell: bash working-directory: ${{ inputs.working-directory }} From 54c86f74d7df4479c11d86af2d8277ec9dbc8a22 Mon Sep 17 00:00:00 2001 From: yordanovsstoyan Date: Tue, 3 Oct 2023 13:00:37 +0300 Subject: [PATCH 06/32] test --- .github/workflows/bump-version-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 0416d89f5..249ffed7d 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -107,7 +107,7 @@ jobs: uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 with: ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + commit-message: "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" github-username: ${{ secrets.github-username }} github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} From d0d3c6076ec5784f7b5f2f7eab2996a94637142c Mon Sep 17 00:00:00 2001 From: yordanovsstoyan Date: Tue, 3 Oct 2023 13:08:49 +0300 Subject: [PATCH 07/32] test --- actions/bump-version/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index 85405cb80..e19087a84 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -45,5 +45,7 @@ runs: fi echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" # We use the case for release-type "patch", because if we do not we get inproper results. For example : 0.0.1-snapshot -> 0.0.3 + # If release-type == patch , we use "bump2version release". This command basically removes the suffix. For example : 0.0.1-snapshot -> 0.0.1 + # In the other case we bump the version (major or minor), then we remove the snapshot suffix shell: bash working-directory: ${{ inputs.working-directory }} From 0b030f3b95785e921775781dcb8abfa8ec6b9d72 Mon Sep 17 00:00:00 2001 From: yordanovsstoyan Date: Wed, 4 Oct 2023 10:39:41 +0300 Subject: [PATCH 08/32] test --- actions/bump-version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index e19087a84..e7d119150 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -36,7 +36,7 @@ runs: parameters=(--no-commit --allow-dirty --no-tag ${{ inputs.release-type }}) test=(${{ inputs.release-type }}) echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - if [[ $test == patch ]]; then + if [[ ${{ inputs.release-type }} == patch ]]; then parameters+=(--new-version ${{ inputs.new-version }}) bump2version --allow-dirty release else From 7a76951b01d25146c9a4774f92916b0bb5549e2d Mon Sep 17 00:00:00 2001 From: yordanovsstoyan Date: Wed, 4 Oct 2023 10:41:43 +0300 Subject: [PATCH 09/32] remove-variable --- actions/bump-version/action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index e7d119150..f7d6fd72a 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -34,7 +34,6 @@ runs: id: bump-version run: | parameters=(--no-commit --allow-dirty --no-tag ${{ inputs.release-type }}) - test=(${{ inputs.release-type }}) echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" if [[ ${{ inputs.release-type }} == patch ]]; then parameters+=(--new-version ${{ inputs.new-version }}) From 2c7f4c01a835d5d840b45373cbea1b051fee5c44 Mon Sep 17 00:00:00 2001 From: yordanovsstoyan Date: Thu, 9 Nov 2023 12:59:54 +0200 Subject: [PATCH 10/32] changes --- .github/workflows/bump-version-release.yaml | 2 +- actions/{patch-snapshot => bump-version-snapshot}/action.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename actions/{patch-snapshot => bump-version-snapshot}/action.yaml (94%) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 249ffed7d..66209ce52 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -98,7 +98,7 @@ jobs: - name: Bump version id: bump-version-snapshot - uses: bakdata/ci-templates/actions/patch-snapshot@feat/new-bumpversion + uses: bakdata/ci-templates/actions/bump-version-snapshot@feat/new-bumpversion with: working-directory: ${{ inputs.working-directory }} test-version: ${{ steps.bump-version.outputs.release-version }} diff --git a/actions/patch-snapshot/action.yaml b/actions/bump-version-snapshot/action.yaml similarity index 94% rename from actions/patch-snapshot/action.yaml rename to actions/bump-version-snapshot/action.yaml index d588e973a..246dadeb9 100644 --- a/actions/patch-snapshot/action.yaml +++ b/actions/bump-version-snapshot/action.yaml @@ -26,7 +26,7 @@ runs: id: bump-version run: | echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - bump2version --allow-dirty patch + bump2version --allow-dirty --no-tag --no-commit patch echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" shell: bash working-directory: ${{ inputs.working-directory }} From a2a3e0cd402074d3fbb43d997ad8877a6fdfd3b0 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 6 Aug 2024 02:59:01 +0200 Subject: [PATCH 11/32] fix: remove redundant action --- actions/bump-version-snapshot/action.yaml | 32 ----------------------- 1 file changed, 32 deletions(-) delete mode 100644 actions/bump-version-snapshot/action.yaml diff --git a/actions/bump-version-snapshot/action.yaml b/actions/bump-version-snapshot/action.yaml deleted file mode 100644 index 246dadeb9..000000000 --- a/actions/bump-version-snapshot/action.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: "Snapshot Patch for Bump Version" -description: "Patch version for snapshot" - -inputs: - working-directory: - description: "The directory containing the `.bumpversion.cfg` file." - required: false - default: "." -outputs: - release-version: - description: "The bumped version of your project." - value: ${{ steps.bump-version.outputs.new-version }} - old-version: - description: "The old version in your `.bumpversion.cfg` file." - value: ${{ steps.bump-version.outputs.old-version }} - -runs: - using: "composite" - steps: - - name: Set up bumpversion - run: | - pipx install bump2version - shell: bash - - - name: Bump version - id: bump-version - run: | - echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - bump2version --allow-dirty --no-tag --no-commit patch - echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - shell: bash - working-directory: ${{ inputs.working-directory }} From 5eea4973405ccd0564d9661ad3c1a583dbcb4574 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 6 Aug 2024 03:01:32 +0200 Subject: [PATCH 12/32] fix: - use bump-my-version instead of deprecated bump2version - merge snapshot action into bump action via parameter - WARN: requires special config - example given --- .github/workflows/bump-version-release.yaml | 12 +++--- actions/bump-version/action.yaml | 48 ++++++++++++++------- docs/actions/bump-version/README.md | 10 ++--- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 66209ce52..07d4a8f04 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -59,11 +59,11 @@ jobs: ref: ${{ github.event.repository.default_branch }} persist-credentials: false # required for pushing to protected branch later - - name: Bump version + - name: Remove snapshot suffix id: bump-version uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion with: - release-type: ${{ inputs.release-type }} + release-type: "release" working-directory: ${{ inputs.working-directory }} - name: Commit and push changes including .bumpversion.cfg file @@ -96,12 +96,12 @@ jobs: release-title: "${{ steps.bump-version.outputs.release-version }}" release-body: "${{ steps.build-changelog.outputs.single-changelog }}" - - name: Bump version - id: bump-version-snapshot - uses: bakdata/ci-templates/actions/bump-version-snapshot@feat/new-bumpversion + - name: Bump to next snapshot version + id: bump-version + uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion with: + release-type: ${{ inputs.release-type }} working-directory: ${{ inputs.working-directory }} - test-version: ${{ steps.bump-version.outputs.release-version }} - name: Commit and push changes including .bumpversion.cfg file uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index f7d6fd72a..362ed28a2 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -1,9 +1,25 @@ name: "Bump version" -description: "Bump version with python bump2version using .bumpversion.cfg" +description: "Bump version with python bump-my-version using .bumpversion.cfg" +# config example .bumpversion.cfg: +# [bumpversion] +# current_version = 1.0.0 +# search = version: {current_version} +# replace = version: {new_version} +# parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-(?Psnapshot))? +# serialize = +# {major}.{minor}.{patch}-{release} +# {major}.{minor}.{patch} + +# [bumpversion:part:release] +# first_value = snapshot +# optional_value = release +# values = +# snapshot +# release inputs: release-type: - description: "The type of the release (major, minor or patch)." + description: "The type of the release (release, major, minor or patch). Release is a special case, where the snapshot suffix is removed." required: true working-directory: description: "The directory containing the `.bumpversion.cfg` file." @@ -25,26 +41,28 @@ outputs: runs: using: "composite" steps: - - name: Set up bump2version + - name: Set up bump-my-version run: | - pipx install bump2version + pipx install bump-my-version shell: bash - name: Bump version id: bump-version run: | - parameters=(--no-commit --allow-dirty --no-tag ${{ inputs.release-type }}) - echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - if [[ ${{ inputs.release-type }} == patch ]]; then - parameters+=(--new-version ${{ inputs.new-version }}) - bump2version --allow-dirty release + parameters=(--no-commit --allow-dirty --no-tag) + echo "old-version=$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" + + if [[ ${{ inputs.new-version }} != "" ]]; then + bump-my-version --new-version ${{ inputs.new-version }} else - bump2version --allow-dirty "${parameters[@]}" - bump2version --allow-dirty release + bump-my-version "${parameters[@]}" ${{ inputs.release-type }} fi - echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" - # We use the case for release-type "patch", because if we do not we get inproper results. For example : 0.0.1-snapshot -> 0.0.3 - # If release-type == patch , we use "bump2version release". This command basically removes the suffix. For example : 0.0.1-snapshot -> 0.0.1 - # In the other case we bump the version (major or minor), then we remove the snapshot suffix + echo "bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" + # release: a.b.c-snapshot -> a.b.c + # release a.b.c -> crash + # major: a.b.c(-snapshot)? -> a+1.0.0-snapshot + # minor: a.b.c(-snapshot)? -> a.b+1.0-snapshot + # patch: a.b.c(-snapshot)? -> a.b.c+1-snapshot + # TLDR: release removes the snapshot suffix shell: bash working-directory: ${{ inputs.working-directory }} diff --git a/docs/actions/bump-version/README.md b/docs/actions/bump-version/README.md index 36370d711..2bc4883a2 100644 --- a/docs/actions/bump-version/README.md +++ b/docs/actions/bump-version/README.md @@ -38,11 +38,11 @@ steps: -| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | -| ----------------- | ------ | -------- | ------- | ----------------------------------------------------- | -| new-version | string | false | | | -| release-type | string | true | | The type of the release (major, minor or patch). | -| working-directory | string | false | `"."` | The directory containing the `.bumpversion.cfg` file. | +| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | +| ----------------- | ------ | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | +| new-version | string | false | | | +| release-type | string | true | | The type of the release (release, major, minor or patch). Release is a special case, where the snapshot suffix is removed. | +| working-directory | string | false | `"."` | The directory containing the `.bumpversion.cfg` file. | From 43f89231d557bcdb251d7bc8d21a87ddf0fa76e8 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 6 Aug 2024 03:04:25 +0200 Subject: [PATCH 13/32] lint: fix actionlint complaints --- .github/workflows/bump-version-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 07d4a8f04..bc403b21c 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -97,7 +97,7 @@ jobs: release-body: "${{ steps.build-changelog.outputs.single-changelog }}" - name: Bump to next snapshot version - id: bump-version + id: bump-version-snapshot uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion with: release-type: ${{ inputs.release-type }} @@ -107,7 +107,7 @@ jobs: uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 with: ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + commit-message: "Bump version ${{ steps.bump-version-snapshot.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" github-username: ${{ secrets.github-username }} github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} From fbfe193d7efd202ae5581954972d3d8235178360 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Thu, 8 Aug 2024 07:06:32 +0200 Subject: [PATCH 14/32] fix: add missing inline bash operator --- actions/bump-version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index 362ed28a2..d4bda06ac 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -57,7 +57,7 @@ runs: else bump-my-version "${parameters[@]}" ${{ inputs.release-type }} fi - echo "bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" + echo "$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" # release: a.b.c-snapshot -> a.b.c # release a.b.c -> crash # major: a.b.c(-snapshot)? -> a+1.0.0-snapshot From c12b09049fb81c2b76d04fe3b27b94a0675f2c66 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Mon, 2 Sep 2024 08:29:27 +0200 Subject: [PATCH 15/32] chore: prep new version for release --- .github/workflows/bump-version-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index bc403b21c..58c22ff6e 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -61,7 +61,7 @@ jobs: - name: Remove snapshot suffix id: bump-version - uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion + uses: bakdata/ci-templates/actions/bump-version@1.46.10 with: release-type: "release" working-directory: ${{ inputs.working-directory }} @@ -98,7 +98,7 @@ jobs: - name: Bump to next snapshot version id: bump-version-snapshot - uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion + uses: bakdata/ci-templates/actions/bump-version@1.46.10 with: release-type: ${{ inputs.release-type }} working-directory: ${{ inputs.working-directory }} From eda6cffa2af010da45942209c197fa8e487af0e5 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Mon, 2 Sep 2024 08:30:22 +0200 Subject: [PATCH 16/32] Revert "chore: prep new version for release" This reverts commit c12b09049fb81c2b76d04fe3b27b94a0675f2c66. --- .github/workflows/bump-version-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 58c22ff6e..bc403b21c 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -61,7 +61,7 @@ jobs: - name: Remove snapshot suffix id: bump-version - uses: bakdata/ci-templates/actions/bump-version@1.46.10 + uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion with: release-type: "release" working-directory: ${{ inputs.working-directory }} @@ -98,7 +98,7 @@ jobs: - name: Bump to next snapshot version id: bump-version-snapshot - uses: bakdata/ci-templates/actions/bump-version@1.46.10 + uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion with: release-type: ${{ inputs.release-type }} working-directory: ${{ inputs.working-directory }} From e592eeca3b5a4e2756bc84dbd4b8870a9faf559f Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 07:27:10 +0200 Subject: [PATCH 17/32] fix: make sure there is an empty string for the comparison --- actions/bump-version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index d4bda06ac..01493b390 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -52,7 +52,7 @@ runs: parameters=(--no-commit --allow-dirty --no-tag) echo "old-version=$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" - if [[ ${{ inputs.new-version }} != "" ]]; then + if [[ "${{ inputs.new-version }}" != "" ]]; then bump-my-version --new-version ${{ inputs.new-version }} else bump-my-version "${parameters[@]}" ${{ inputs.release-type }} From f1bc6f089fc7ac15ae3c01220d1b509c5232b24c Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 07:28:20 +0200 Subject: [PATCH 18/32] fix: remove deprecated flags --- actions/bump-version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index 01493b390..7a8f8e0ed 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -49,7 +49,7 @@ runs: - name: Bump version id: bump-version run: | - parameters=(--no-commit --allow-dirty --no-tag) + parameters=(--allow-dirty) echo "old-version=$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" if [[ "${{ inputs.new-version }}" != "" ]]; then From e58ea38d3f5e8c95fa536132928d93a3d2c87795 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 07:29:35 +0200 Subject: [PATCH 19/32] fix: only use bump --- actions/bump-version/action.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index 7a8f8e0ed..715dec185 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -49,13 +49,12 @@ runs: - name: Bump version id: bump-version run: | - parameters=(--allow-dirty) echo "old-version=$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" if [[ "${{ inputs.new-version }}" != "" ]]; then bump-my-version --new-version ${{ inputs.new-version }} else - bump-my-version "${parameters[@]}" ${{ inputs.release-type }} + bump-my-version bump ${{ inputs.release-type }} fi echo "$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" # release: a.b.c-snapshot -> a.b.c From 332f3eb59c106ec62f7f8ce90b0bc45f69131f6e Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 07:30:54 +0200 Subject: [PATCH 20/32] fix: proper outpuit --- actions/bump-version/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/bump-version/action.yaml b/actions/bump-version/action.yaml index 715dec185..8091b6965 100644 --- a/actions/bump-version/action.yaml +++ b/actions/bump-version/action.yaml @@ -56,7 +56,7 @@ runs: else bump-my-version bump ${{ inputs.release-type }} fi - echo "$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" + echo "new-version=$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" # release: a.b.c-snapshot -> a.b.c # release a.b.c -> crash # major: a.b.c(-snapshot)? -> a+1.0.0-snapshot From 7df58c7353b1f30102e5920401c6159de647b104 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 09:49:12 +0200 Subject: [PATCH 21/32] fix: new chamgelog action --- .github/workflows/bump-version-release.yaml | 12 ++---------- docs/workflows/bump-version-release/README.md | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index bc403b21c..299b5d7d0 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -13,11 +13,6 @@ on: required: false default: true type: boolean - changelog-config: - description: "Changelog config path." - required: false - default: "" - type: string working-directory: description: "Working directory containing `.bumpversion.cfg`. (Default is .)" required: false @@ -77,14 +72,11 @@ jobs: - name: Create changelog id: build-changelog - uses: bakdata/ci-templates/actions/changelog-generate@1.35.0 + uses: bakdata/ci-templates/actions/changelog-generate@tiedemann/changelog-action if: ${{ inputs.changelog }} with: github-token: ${{ secrets.github-token }} - config: ${{ inputs.changelog-config }} - new-tag: ${{ steps.bump-version.outputs.release-version }} - fetch-reviewers: "true" - fetch-release-information: "true" + tag: ${{ steps.bump-version.outputs.release-version }} - name: Tag and release uses: bakdata/ci-templates/actions/tag-and-release@v1.22.0 diff --git a/docs/workflows/bump-version-release/README.md b/docs/workflows/bump-version-release/README.md index 2f70664a3..a3e2017ee 100644 --- a/docs/workflows/bump-version-release/README.md +++ b/docs/workflows/bump-version-release/README.md @@ -64,7 +64,6 @@ jobs: | INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | | ----------------- | ------- | -------- | ------- | --------------------------------------------------------------- | | changelog | boolean | false | `true` | Create changelog for release. | -| changelog-config | string | false | | Changelog config path. | | release-type | string | true | | Scope of the release (major, minor or patch). | | working-directory | string | false | `"."` | Working directory containing `.bumpversion.cfg`. (Default is .) | From e1702734d3869c46731a364da748c30a0702d308 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 10:01:55 +0200 Subject: [PATCH 22/32] fix: use different commit message for second commit --- .github/workflows/bump-version-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 299b5d7d0..97f6068d0 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -99,7 +99,7 @@ jobs: uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 with: ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version-snapshot.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + commit-message: "Bump version ${{ steps.bump-version-snapshot.outputs.release-version }} → SNAPSHOT" github-username: ${{ secrets.github-username }} github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} From e091bd61227be3fbc629b705022c91c98608abc3 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 10:06:47 +0200 Subject: [PATCH 23/32] test From f1ec7de669f5b3a7e799f77559dacd8c6f303d85 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 10:10:16 +0200 Subject: [PATCH 24/32] fix: try single push --- .github/workflows/bump-version-release.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 97f6068d0..67e3eb0f8 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -60,15 +60,10 @@ jobs: with: release-type: "release" working-directory: ${{ inputs.working-directory }} - - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 - 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: Commit Suffix removal + run: | + git add .bumpversion.cfg + git commit -m "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" - name: Create changelog id: build-changelog From 9365e3d2c156b6e4536713c5b0825b06f2a0c6f6 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 10:13:26 +0200 Subject: [PATCH 25/32] fix: add git username + email --- .github/workflows/bump-version-release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 67e3eb0f8..be8af1d07 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -62,6 +62,8 @@ jobs: working-directory: ${{ inputs.working-directory }} - name: Commit Suffix removal run: | + git config user.email ${{ secrets.github-email }} + git config user.name ${{ secrets.github-username }} git add .bumpversion.cfg git commit -m "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" From 78af69603c909b4ed9d18dc5d1929d3073d94c79 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 10:19:44 +0200 Subject: [PATCH 26/32] fix: try with push --- .github/workflows/bump-version-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index be8af1d07..13f65ae95 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -66,6 +66,7 @@ jobs: git config user.name ${{ secrets.github-username }} git add .bumpversion.cfg git commit -m "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" + git push - name: Create changelog id: build-changelog From e70c241bb35985e9786dbed241b056fb47802d62 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 20:36:45 +0200 Subject: [PATCH 27/32] fix: add pull command --- .github/workflows/bump-version-release.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 13f65ae95..6e571ac14 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -60,14 +60,18 @@ jobs: with: release-type: "release" working-directory: ${{ inputs.working-directory }} - - name: Commit Suffix removal - run: | - git config user.email ${{ secrets.github-email }} - git config user.name ${{ secrets.github-username }} - git add .bumpversion.cfg - git commit -m "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" - git push + - name: Commit and push changes including .bumpversion.cfg file + uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 + 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: Pull latest changes + run: git pull + shell: bash - name: Create changelog id: build-changelog uses: bakdata/ci-templates/actions/changelog-generate@tiedemann/changelog-action From 5926df297099ea69d18bc26402a82b31d37bdcbc Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 20:39:29 +0200 Subject: [PATCH 28/32] fix: add git config --- .github/workflows/bump-version-release.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 6e571ac14..1b8ee0953 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -69,9 +69,14 @@ jobs: github-username: ${{ secrets.github-username }} github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} + - name: Pull latest changes - run: git pull + run: | + git config user.email ${{ secrets.github-email }} + git config user.name ${{ secrets.github-username }} + git pull shell: bash + - name: Create changelog id: build-changelog uses: bakdata/ci-templates/actions/changelog-generate@tiedemann/changelog-action From cb5bc5b166ba64fbd6f5eec56cd1ad953e482afb Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 20:46:10 +0200 Subject: [PATCH 29/32] fix: try to use checkout to pull the latest changes --- .github/workflows/bump-version-release.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 1b8ee0953..5d145d3aa 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -70,12 +70,11 @@ jobs: github-email: ${{ secrets.github-email }} github-token: ${{ secrets.github-token }} - - name: Pull latest changes - run: | - git config user.email ${{ secrets.github-email }} - git config user.name ${{ secrets.github-username }} - git pull - shell: bash + - name: Check out repository + uses: bakdata/ci-templates/actions/checkout@1.32.0 + with: + ref: ${{ github.event.repository.default_branch }} + persist-credentials: false # required for pushing to protected branch later - name: Create changelog id: build-changelog From 1800eff5a01aa607270de78d5fa1859a79687b87 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 22:19:28 +0200 Subject: [PATCH 30/32] fix: try using normal git commits --- .github/workflows/bump-version-release.yaml | 41 ++++++++++----------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 5d145d3aa..ed59c1513 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -54,6 +54,11 @@ jobs: ref: ${{ github.event.repository.default_branch }} persist-credentials: false # required for pushing to protected branch later + - name: Setup Git + run: | + git config --global user.name "${{ secrets.github-username }}" + git config --global user.email "${{ secrets.github-email }}" + - name: Remove snapshot suffix id: bump-version uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion @@ -61,20 +66,13 @@ jobs: release-type: "release" working-directory: ${{ inputs.working-directory }} - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 - 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: Check out repository - uses: bakdata/ci-templates/actions/checkout@1.32.0 - with: - ref: ${{ github.event.repository.default_branch }} - persist-credentials: false # required for pushing to protected branch later + - name: Commit .bumpversion.cfg file without snapshot + run: | + git add .bumpversion.cfg + git commit -m "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" + git fetch origin + git rebase --strategy-option=theirs origin/main + git push --verbose - name: Create changelog id: build-changelog @@ -101,11 +99,10 @@ jobs: release-type: ${{ inputs.release-type }} working-directory: ${{ inputs.working-directory }} - - name: Commit and push changes including .bumpversion.cfg file - uses: bakdata/ci-templates/actions/commit-and-push@v1.6.0 - with: - ref: ${{ github.event.repository.default_branch }} - commit-message: "Bump version ${{ steps.bump-version-snapshot.outputs.release-version }} → SNAPSHOT" - github-username: ${{ secrets.github-username }} - github-email: ${{ secrets.github-email }} - github-token: ${{ secrets.github-token }} + - name: Commit .bumpversion.cfg file new version and snapshot + run: | + git add .bumpversion.cfg + git commit -m "Bump version ${{ steps.bump-version-snapshot.outputs.old-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + git fetch origin + git rebase --strategy-option=theirs origin/main + git push --verbose From c3668a6b91f023169c0eb5d71002d11e8edb6ca2 Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 22:25:11 +0200 Subject: [PATCH 31/32] fix: persist credentials --- .github/workflows/bump-version-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index ed59c1513..8733b2990 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -52,7 +52,7 @@ jobs: uses: bakdata/ci-templates/actions/checkout@1.32.0 with: ref: ${{ github.event.repository.default_branch }} - persist-credentials: false # required for pushing to protected branch later + persist-credentials: true # required for pushing to protected branch later - name: Setup Git run: | From 892c70431f536b64dbe99e021aac8e9b366afe3b Mon Sep 17 00:00:00 2001 From: Jan Max Tiedemann Date: Tue, 3 Sep 2024 22:38:06 +0200 Subject: [PATCH 32/32] fix: make commit message correct --- .github/workflows/bump-version-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index 8733b2990..9631a8620 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -102,7 +102,7 @@ jobs: - name: Commit .bumpversion.cfg file new version and snapshot run: | git add .bumpversion.cfg - git commit -m "Bump version ${{ steps.bump-version-snapshot.outputs.old-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" + git commit -m "Bump version ${{ steps.bump-version.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" git fetch origin git rebase --strategy-option=theirs origin/main git push --verbose