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
This commit is contained in:
2021-08-07 13:56:25 +09:30
parent eb5cc8a0e2
commit f76cabeeb0

View File

@ -15,12 +15,12 @@
- pip install $ROOT_DIR/gitlab_release/python-module/cz_nfc/. - 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"' - 'CLONE_URL="https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git"'
- echo "[DEBUG] CLONE_URL[$CLONE_URL]" - echo "[DEBUG] CLONE_URL[$CLONE_URL]"
- git clone -b $CI_COMMIT_BRANCH $CLONE_URL repo - git clone -b development $CLONE_URL repo
- cd repo - cd repo
- git branch - git branch
- git config --global user.email "CI@nfc-gitlab" - git config --global user.email "CI@nfc-gitlab"
- git config --global user.name "NFC CI" - 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) - RELEASE_VERSION_CURRENT=$(cz -n cz_nfc version --project)
script: script:
- "$MY_COMMAND" - "$MY_COMMAND"
@ -36,14 +36,20 @@
- echo "[DEBUG] RELEASE_TAG_SHA1[$RELEASE_TAG_SHA1]" - 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 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 [ "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: after_script:
- rm -Rf repo - rm -Rf repo
rules: rules:
- if: "$CI_COMMIT_AUTHOR =='NFC CI <CI@nfc-gitlab>'" - if: "$CI_COMMIT_AUTHOR =='NFC CI <CI@nfc-gitlab>'"
when: never when: never
- if: '$CI_COMMIT_BRANCH == "development"' - if: '$CI_COMMIT_BRANCH == "master"'
- if: '$TRIGGER_RELEASE == "True" && $CI_COMMIT_BRANCH == "development"' when: always
when: on_success
allow_failure: false allow_failure: false
- if: '$CI_COMMIT_BRANCH == "development"'
when: manual
allow_failure: true
- when: never - when: never