This repository was archived by the owner on Mar 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-10
lines changed Expand file tree Collapse file tree 2 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -53,16 +53,11 @@ jobs:
53
53
- run : pip install git-semver
54
54
- run : git config --global user.email "${GIT_MAIL}"
55
55
- run : git config --global user.name "${GIT_USER}"
56
+ - run : ./bump_version >> $BASH_ENV
56
57
- run : |
57
- GIT_TAG=none
58
- echo "Last commit message: ${GIT_COMMIT_DESC}"
59
- case "${GIT_COMMIT_DESC}" in
60
- *"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
61
- *"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
62
- *"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
63
- *) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
64
- esac
65
- echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
58
+ if [[ "${NEW_TAG}" == 'none' ]]; then
59
+ echo "Keyword not detected. Doing nothing" && circleci-agent step halt
60
+ fi
66
61
- run : |
67
62
docker run -it --rm \
68
63
-v "${CIRCLE_WORKING_DIRECTORY}:/role" \
73
68
--token "${GH_TOKEN}" \
74
69
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
75
70
--unreleased-label "**Next release**" --no-compare-link \
76
- --future-release "${GIT_TAG }"
71
+ --future-release "${NEW_TAG }"
77
72
- run : git add CHANGELOG.md
78
73
- run : git commit -m "[ci skip] Automatic changelog update"
79
74
- run : git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ #
3
+ # Description: Generate the next release version
4
+
5
+ set -uo pipefail
6
+
7
+ latest_tag=" $( git semver) "
8
+ if [[ -z " ${latest_tag} " ]]; then
9
+ echo " ERROR: Couldn't get latest tag from git semver, try 'pip install git-semver'" 2>&1
10
+ exit 1
11
+ fi
12
+
13
+ # Use HEAD if CIRCLE_SHA1 is not set.
14
+ now=" ${CIRCLE_SHA1:- HEAD} "
15
+
16
+ new_tag=' none'
17
+ git_log=" $( git log --format=%B " ${latest_tag} ..${now} " ) "
18
+
19
+ case " ${git_log} " in
20
+ * " [major]" * |* " [breaking change]" * ) new_tag=$( git semver --next-major) ;;
21
+ * " [minor]" * |* " [feat]" * |* " [feature]" * ) new_tag=$( git semver --next-minor) ;;
22
+ * " [patch]" * |* " [fix]" * |* " [bugfix]" * ) new_tag=$( git semver --next-patch) ;;
23
+ esac
24
+
25
+ echo " NEW_TAG=${new_tag} "
You can’t perform that action at this time.
0 commit comments