From f76cabeeb04b028a231dc1c232862db5fcad4345 Mon Sep 17 00:00:00 2001 From: Jon Lockwood Date: Sat, 7 Aug 2021 13:56:25 +0930 Subject: [PATCH 1/2] fix(gitlab_release): Adjust release workflow Previous release workflow only allowed version increment of RC on development brnach. adjust to the following workflow: master branch: automatically increment the version development branch: option to manually increment version (RC increment only) !2 --- gitlab_release/.gitlab-ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gitlab_release/.gitlab-ci.yml b/gitlab_release/.gitlab-ci.yml index 996cb94..6714c38 100644 --- a/gitlab_release/.gitlab-ci.yml +++ b/gitlab_release/.gitlab-ci.yml @@ -15,12 +15,12 @@ - pip install $ROOT_DIR/gitlab_release/python-module/cz_nfc/. - 'CLONE_URL="https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git"' - echo "[DEBUG] CLONE_URL[$CLONE_URL]" - - git clone -b $CI_COMMIT_BRANCH $CLONE_URL repo + - git clone -b development $CLONE_URL repo - cd repo - git branch - git config --global user.email "CI@nfc-gitlab" - git config --global user.name "NFC CI" - - git push --set-upstream origin $CI_COMMIT_BRANCH + - git push --set-upstream origin development - RELEASE_VERSION_CURRENT=$(cz -n cz_nfc version --project) script: - "$MY_COMMAND" @@ -36,14 +36,20 @@ - echo "[DEBUG] RELEASE_TAG_SHA1[$RELEASE_TAG_SHA1]" - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No push will be conducted, version was not bumped"; else git push; fi - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No release will be created, version was not bumped"; else release-cli create --name "Release $RELEASE_TAG" --tag-name "$RELEASE_TAG" --ref "$RELEASE_TAG_SHA1" --description "$RELEASE_CHANGELOG"; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git checkout master; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push --set-upstream origin master; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git merge --no-ff development; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push origin master; fi after_script: - rm -Rf repo rules: - if: "$CI_COMMIT_AUTHOR =='NFC CI '" when: never - - if: '$CI_COMMIT_BRANCH == "development"' - - if: '$TRIGGER_RELEASE == "True" && $CI_COMMIT_BRANCH == "development"' - when: on_success + - if: '$CI_COMMIT_BRANCH == "master"' + when: always allow_failure: false + - if: '$CI_COMMIT_BRANCH == "development"' + when: manual + allow_failure: true - when: never From 5f273ce23a331eaf11623207ec4aba8b856c14f0 Mon Sep 17 00:00:00 2001 From: Jon Lockwood Date: Sat, 7 Aug 2021 14:56:51 +0930 Subject: [PATCH 2/2] docs(gitlab_release): Updated docs with new instructions on version incrementing BREAKING CHANGE: !2 --- gitlab_release/README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gitlab_release/README.md b/gitlab_release/README.md index 1016096..d0a4fa9 100644 --- a/gitlab_release/README.md +++ b/gitlab_release/README.md @@ -1,5 +1,17 @@ # Gitlab Release -This job bumps the version, updates the changelog, creates a git tag and creates a gitlab release. The git tag and release title use [semantic versioning](https://semver.org/). for this job to function correctly a `.cz.yaml` is required in the root of the repository. this file contains the [commitizen](https://github.com/commitizen-tools/commitizen) config and the version details. This job runs on successful completion of previous jobs and only on `development` and `master` branches. +This job bumps the version, updates the changelog, creates a git tag and creates a gitlab release. The git tag and release title use [semantic versioning](https://semver.org/). for this job to function correctly a `.cz.yaml` is required in the root of the repository. this file contains the [commitizen](https://github.com/commitizen-tools/commitizen) config and the version details. + +This job has the following workflow: + +- `master` Branch + > Automatically increment the version + +- `development` Branch + > Manual CI job made available to increment the version. (release-candidate increment only) + +| :octagonal_sign: Danger | +|:----| +| *If prior to merging to the master branch you do a version increment, and there are no commits prior to merging. the job will not increment the version and the job will fail. it is recommended that you only do a version increment on the `development` branch if you are going to commit further changes to the `development` branch* | This job provides the following badge: @@ -8,7 +20,7 @@ This job provides the following badge: ## Dependencies -- This job will only run if all previous jobs run. +- None ## your .gitlab-ci.yml changes To use this job add the following to your `.gitlab-ci.yml` file @@ -54,15 +66,3 @@ This CI job's workflow is: ## License To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) - - - - - - - - - - - -