-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
- Add this
.cz.yamlcommitizen config file (versionis the current code version):
YAML
commitizen:
tag_format: v$version
version: 1.4.0
version_files:
- k8s live/manifest-api.yaml:join-the-dots-infra/api
- k8s live/manifest-web.yaml:join-the-dots-infra/web
- Add an access token to the repository with read/write repo permissions. Name it
ci-runneror something. - Add the token and its username (in the format
token-name:token-value, e.g.ci-runner:abcd1234) to the CI/CD variables under Settings > CI/CD > Variables. Name itCI_PATand check the "masked" box to make it hidden. - Add this variable to
.gitlab-ci.yml:CI_REMOTE_URL: https://$CI_PAT@$CI_SERVER_HOST/informatics/join-the-dots-infra.git - You need a variable that's the code version without the
v, so to avoid having to change everything else I'd change the variables to this:
YAML
CODE_VERSION_NUMBER: 1.4.0
CODE_VERSION: v$CODE_VERSION_NUMBER
- This is the commitizen bump job:
YAML
bump-live:
stage: build-live
image: python:3.12
before_script:
- pip install -U commitizen
- pip install -U cz-nhm
script:
- git config user.name "$GITLAB_USER_NAME"
- git config user.email "$GITLAB_USER_EMAIL"
- git remote set-url --push origin $CI_REMOTE_URL
- git checkout -b $CI_COMMIT_BRANCH
- cz -nr 21 bump --yes --no-verify --allow-no-commit $CODE_VERSION_NUMBER
- git push origin $CI_COMMIT_BRANCH:$CI_COMMIT_REF_NAME
- git push origin $CODE_VERSION
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
I would add it to the build-live stage and then add it to the dependencies for build-live-web and build-live-api (so it has to run first), but you can decide what works best. You can remove the last git push if you don't want tags.
When you want to push a new version, you change the CODE_VERSION_NUMBER variable and (theoretically) everything else should update automatically.
Metadata
Metadata
Assignees
Labels
No labels