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

24.8 workflow to bump version #532

Open
wants to merge 2 commits into
base: customizations/24.8.7
Choose a base branch
from
Open
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
59 changes: 59 additions & 0 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: bump version
permissions:
contents: write
# Upstream uses last portion of the version as a unique part to differentiate builds
# created from different commits. Last part (or VERSION_TWEAK) is basically a number
# of commits since the last tag (computed automatically by git).
# That works well for them, since they release from the same branch: e.g. 24.8,
# adding stuff to it and eventually pushing out the release.
#
# For Altinity we use different branches, and we don't put upstream tags to our repo.
# Hence we can't rely on this automatic behaviour from git.
#
# So in order to generate new version, whenever it makes sense, and to make it different from
# upstream's (Altinity versions have VERSION_TWEAK >= upsteam's versions VERSION_TWEAK)
# we increment existing VERSION_TWEAK by 1 each time.

env:
# version suffix to use in cmake/autogenerated_versions_new.txt
# due to current content of that file, anything different than 'altinitystable'
# will prepended to the VERSION_DESCRIBE-part.
# e.g. VERSION_TYPE: 'new' ==> VERSION_DESCRIBE='24.8.1.23.altinitystable-new'
VERSION_TYPE: altinitystable

on:
push:
branches:
# At the moment it seems wise to not execute on release branches:
# this workflow produces a new commit with a new version value,
# which might conflict with (already started by another workflow)
# build & release process, potentially cancelling it and
# re-triggering and re-doing of all of the builds and delaying the release.
- 'customizations/**'

jobs:
bump-version:
runs-on: [ubuntu-latest]
steps:
- name: checkout repo
uses: actions/checkout@v4

- name: Update cmake/autogenerated_versions.txt
run: |
awk 'match($0, /^(SET\(VERSION_TWEAK) ([0-9])+(.*\))/, m) { print(m[1] " " strtonum($2) + 1 "" m[3]) ; next } 1' \
cmake/autogenerated_versions.txt > cmake/autogenerated_versions_new.txt
mv cmake/autogenerated_versions_new.txt cmake/autogenerated_versions.txt
cat cmake/autogenerated_versions.txt
# update rest of the version info (mostly VERSION_DESCRIBE and VERSION_STRING)
python3 tests/ci/version_helper.py --update-cmake --version-type=${{ env.VERSION_TYPE }}

- name: push updated cmake/autogenerated_versions.txt
run: |
set -x
# export version info as multiple variables
source <(python3 tests/ci/version_helper.py --export --version-type='altinitystable')
git config --global user.email [email protected]
git config --global user.name altinity-robot
git config --global commit.gpgsign false
git commit -m "Bumped version to $CLICKHOUSE_VERSION_DESCRIBE" -- cmake/autogenerated_versions.txt
git push
5 changes: 4 additions & 1 deletion tests/ci/version_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
SET(VERSION_MAJOR {major})
SET(VERSION_MINOR {minor})
SET(VERSION_PATCH {patch})
SET(VERSION_TWEAK {tweak})
SET(VERSION_FLAVOUR {flavour})
SET(VERSION_GITHASH {githash})
SET(VERSION_DESCRIBE {describe})
SET(VERSION_STRING {string})
Expand Down Expand Up @@ -177,10 +179,11 @@ def as_dict(self) -> VERSIONS:
"major": self.major,
"minor": self.minor,
"patch": self.patch,
"tweak": self.tweak,
"githash": self.githash,
"describe": self.describe,
"string": self.string,
"tweak": self._tweak or "",
"flavour": self._flavour or "",
}

def as_tuple(self) -> Tuple[int, int, int, int]:
Expand Down
Loading