From 6df912622e52e1c483f11c4d1c0a5739aed8ee37 Mon Sep 17 00:00:00 2001 From: Ewa Czechowska Date: Fri, 1 Feb 2019 19:07:17 +0100 Subject: [PATCH] make github release happen on CI --- CHANGELOG.md | 1 + ci.gocd.yaml | 15 ++++++++++++++- tasks | 14 +++++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1a1182..d10c760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ * fix: resolve relative paths in config object * fix: allow docker and docker-compose run if WorkDirOuter or IdentityDirOuter does not exist +* make github release happen on CI ### 0.2.0 (2019-Jan-25) diff --git a/ci.gocd.yaml b/ci.gocd.yaml index bc7cd5c..f16abb1 100644 --- a/ci.gocd.yaml +++ b/ci.gocd.yaml @@ -93,6 +93,8 @@ pipelines: - cd image_scripts && ./tasks e2e - release: clean_workspace: true + secure_variables: + GITHUB_TOKEN: "AES:9mQGklAskrmLBczL1b/UXQ==:u/Kt5dVTpXlDIOTN7ndS6SId01ryLQK+8OorJS7ZA8EECQvc04daQkLA+gRuzHNg" approval: type: manual jobs: @@ -108,4 +110,15 @@ pipelines: command: bash arguments: - -c - - ./tasks release \ No newline at end of file + - ./tasks release + - fetch: + stage: build_unit + job: build_unit + is_file: yes + source: dojo + destination: bin + - exec: + command: bash + arguments: + - -c + - ./tasks release_gh diff --git a/tasks b/tasks index 878a007..307dfaa 100755 --- a/tasks +++ b/tasks @@ -31,7 +31,7 @@ case "${command}" in if [[ -n "$2" ]]; then next_version="$2" else - last_version="$(get_last_version_from_changelog ${changelog_file})" + last_version="$(get_last_version_from_whole_changelog ${changelog_file})" next_version="$(bump_patch_version ${last_version})" fi set_version_in_changelog "${changelog_file}" "${next_version}" @@ -41,7 +41,7 @@ const DojoVersion = \"${next_version}\" releaser_log_info "Set version: ${next_version}" ;; verify_version) - version="$(get_last_version_from_changelog ${changelog_file})" + version="$(get_last_version_from_whole_changelog ${changelog_file})" if git tag | grep "${version}"; then releaser_log_error "The version: ${version} was already git tagged" exit 1 @@ -58,14 +58,18 @@ const DojoVersion = \"${next_version}\" releaser_log_info "Version: ${version} verified successfully" ;; release) - version="$(get_last_version_from_changelog ${changelog_file})" + version="$(get_last_version_from_whole_changelog ${changelog_file})" git tag "${version}" git push origin "${version}" ;; release_gh) + if [ ! -f bin/dojo ]; then echo "dojo binary does not exist"; exit 1; fi if [ -z "$GITHUB_TOKEN" ]; then echo "GITHUB_TOKEN is unset"; exit 1; fi - ide "./tasks build" - ide --idefile Idefile.nodejs "sudo npm install --global release-it && release-it --verbose" + version="$(get_last_version_from_whole_changelog ${changelog_file})" + git remote add upstream git@github.com:ai-traders/dojo.git + git pull upstream master + git push --tags upstream master + ide --idefile Idefile.nodejs "sudo npm install --global release-it && release-it --verbose --increment=${version} --non-interactive" ;; generate_release_notes) version=${2?version not set}