Skip to content
Snippets Groups Projects
Unverified Commit b169a41b authored by paulfantom's avatar paulfantom
Browse files

Simplify release process

* Generate changelog only on commits resulting in tag
* Use ghr to create release
parent 077fdfbf
Branches
Tags
No related merge requests found
...@@ -51,31 +51,33 @@ jobs: ...@@ -51,31 +51,33 @@ jobs:
*"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;; *"[patch]"*|*"[fix]"*|*"[bugfix]"* ) GIT_TAG=$(git semver --next-patch) ;;
*"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;; *"[minor]"*|*"[feat]"*|*"[feature]"* ) GIT_TAG=$(git semver --next-minor) ;;
*"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;; *"[major]"*|*"[breaking change]"* ) GIT_TAG=$(git semver --next-major) ;;
*) echo "Keyword not detected. Doing nothing" ;; *) echo "Keyword not detected. Doing nothing" && circleci-agent step halt ;;
esac esac
echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV echo "GIT_TAG=${GIT_TAG}" >> $BASH_ENV
if [ "${GIT_TAG}" != "none" ]; then
echo "Assigning new tag: ${GIT_TAG}"
git tag "${GIT_TAG}" -a -m "Automatic tag generation for travis build no. ${CIRCLE_BUILD_NUM}"
git push "https://${GH_TOKEN}:@${GIT_URL}" --tags || circleci-agent step halt
fi
- run: | - run: |
docker run -it --rm \ docker run -it --rm \
-v "${CIRCLE_WORKING_DIRECTORY}:/usr/local/src/your-app" \ -v "${CIRCLE_WORKING_DIRECTORY}:/role" \
-u "${CIRCLE_PROJECT_USERNAME}" -p "${CIRCLE_PROJECT_REPONAME}" \ -w "/role" \
ferrarimarco/github-changelog-generator:1.15.2 \
--user "${CIRCLE_PROJECT_USERNAME}" \
--project "${CIRCLE_PROJECT_REPONAME}" \
--token "${GH_TOKEN}" \ --token "${GH_TOKEN}" \
--release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \ --release-url "https://galaxy.ansible.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME#ansible-}" \
--unreleased-label "**Next release**" --no-compare-link --unreleased-label "**Next release**" --no-compare-link \
--future-release "${GIT_TAG}"
- run: git add CHANGELOG.md - run: git add CHANGELOG.md
- run: git commit -m '[ci skip] Automatic changelog update' - run: git commit -m "[ci skip] Automatic changelog update"
- run: git tag "${GIT_TAG}" -a -m "Automatic tag generation for CI build no. ${CIRCLE_BUILD_NUM}"
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" --tags || circleci-agent step halt
- run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt - run: git push "https://${GH_TOKEN}:@${GIT_URL}" || circleci-agent step halt
- run: | - run: |
if [[ "${GIT_TAG}" != "none" ]]; then ghr \
docker run -it \ -t ${GH_TOKEN} \
-e CHANDLER_GITHUB_API_TOKEN="${GH_TOKEN}" \ -u ${CIRCLE_PROJECT_USERNAME} \
-v "${CIRCLE_WORKING_DIRECTORY}:/chandler" \ -r ${CIRCLE_PROJECT_REPONAME} \
whizark/chandler push "${GIT_TAG}" -n ${GIT_TAG} \
fi -b "$(sed -n -e '/## \[0.22.0\]/,/## \[/ p' CHANGELOG.md | sed -e '$ d')" \
${GIT_TAG} ./artifacts/ # We don't have artifacts but ghr still needs sth
workflows: workflows:
version: 2 version: 2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment