diff --git a/.circleci/config.yml b/.circleci/config.yml index 86d2517db..8d8f918bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,6 +20,7 @@ references: GIT_USERNAME: "zup-ci" GIT_NAME: "Zup CI" BUILD_IMAGE: *GOLANG_IMAGE + VERSION_PLACEHOLDER: 1.0.0-betaPLACEHOLDER filters: &FILTERS_DELIVERY branches: @@ -270,6 +271,17 @@ jobs: . ./.circleci/scripts/version.sh make release + release_creator: + environment: + <<: *ENVIRONMENT + executor: release-executor + steps: + - checkout + - run: + name: Checking if we need to release any new features + command: | + make release-creator + rebase_nightly: environment: <<: *ENVIRONMENT @@ -281,6 +293,17 @@ jobs: command: | make rebase-nightly + rebase_beta: + environment: + <<: *ENVIRONMENT + executor: release-executor + steps: + - checkout + - run: + name: Rebase Beta + command: | + make rebase-beta + unix_smoke_test: executor: ritchie-tests-executor environment: @@ -315,6 +338,16 @@ jobs: workflows: + release_trigger: + triggers: + - schedule: + cron: "0 10 * * 1" + filters: + branches: + only: + - beta + jobs: + - release_creator nightly: triggers: - schedule: @@ -325,6 +358,31 @@ workflows: - master jobs: - rebase_nightly + beta: + triggers: + - schedule: + cron: "0 8 * * 1,4" + filters: + branches: + only: + - nightly + jobs: + - build: + name: build-code + - windows_functional_test_team: + name: windows-functional-test-team-code + requires: + - build-code + - windows_functional_test_single: + name: windows-functional-test-single-code + requires: + - build-code + - rebase_beta: + name: release-beta + requires: + - windows-functional-test-team-code + - windows-functional-test-single-code + build-for-requests: jobs: - lint: @@ -360,18 +418,6 @@ workflows: <<: *FILTERS_CHECK_CODE requires: - build-code -# - windows_functional_test_team: -# name: windows-functional-test-team-code -# filters: -# <<: *FILTERS_CHECK_CODE -# requires: -# - build-code -# - windows_functional_test_single: -# name: windows-functional-test-single-code -# filters: -# <<: *FILTERS_CHECK_CODE -# requires: -# - build-code release: jobs: - build: @@ -386,7 +432,6 @@ workflows: - build-code - release: name: release - type: approval filters: <<: *FILTERS_RELEASE requires: diff --git a/.circleci/scripts/beta.sh b/.circleci/scripts/beta.sh new file mode 100755 index 000000000..b368f2b00 --- /dev/null +++ b/.circleci/scripts/beta.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +BETA_VERSION=$(expr $(curl -s https://commons-repo.ritchiecli.io/stable.txt| rev | cut -d . -f -1|rev) + 1) + +echo "$VERSION_PLACEHOLDER" | sed "s/PLACEHOLDER/.pre.${BETA_VERSION}/" \ No newline at end of file diff --git a/.circleci/scripts/gonna_release.sh b/.circleci/scripts/gonna_release.sh new file mode 100755 index 000000000..f6ab4f7ed --- /dev/null +++ b/.circleci/scripts/gonna_release.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +DEPLOYED_VERSION=$(curl -s https://commons-repo.ritchiecli.io/stable.txt) + +VERSION_TO_CHECK_AGAINST=$($VERSION_PLACEHOLDER | sed "s/PLACEHOLDER//") + +if [ "$DEPLOYED_VERSION" == "$VERSION_TO_CHECK_AGAINST" ]; then + echo "RELEASE" +fi + +echo "ABORT" \ No newline at end of file diff --git a/.circleci/scripts/version.sh b/.circleci/scripts/version.sh index 1b922cb42..d8f7ee691 100755 --- a/.circleci/scripts/version.sh +++ b/.circleci/scripts/version.sh @@ -7,7 +7,7 @@ elif expr "$CIRCLE_BRANCH" : '^release-.*' >/dev/null; then elif expr "$CIRCLE_BRANCH" : '^nightly' >/dev/null; then export RELEASE_VERSION="nightly" elif expr "$CIRCLE_BRANCH" : '^beta' >/dev/null; then - export RELEASE_VERSION="beta" + export RELEASE_VERSION="$(.circleci/scripts/beta.sh)" else export RELEASE_VERSION=$(curl https://commons-repo.ritchiecli.io/stable.txt) echo "" diff --git a/Makefile b/Makefile index dceccfa9e..8624dc95c 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,9 @@ BUCKET=$(shell VERSION=$(VERSION) ./.circleci/scripts/bucket.sh) RITCHIE_ENV=$(shell VERSION=$(VERSION) ./.circleci/scripts/ritchie_env.sh) COMMONS_REPO_URL=https://commons-repo.ritchiecli.io/tree/tree.json IS_RELEASE=$(shell echo $(VERSION) | egrep "^[0-9.]+|qa-.*") +IS_BETA=$(shell echo $(VERSION) | egrep "^beta-.*") +GONNA_RELEASE=$(shell ./.circleci/scripts/gonna_release.sh) +VERSION_TO_CHECK_AGAINST=$(shell echo $VERSION_PLACEHOLDER | sed "s/PLACEHOLDER//") build: mkdir -p $(DIST_MAC_TEAM) $(DIST_MAC_SINGLE) $(DIST_LINUX_TEAM) $(DIST_LINUX_SINGLE) $(DIST_WIN_TEAM) $(DIST_WIN_SINGLE) @@ -88,6 +91,10 @@ ifneq "$(IS_RELEASE)" "" echo -n "$(RELEASE_VERSION)" > stable.txt aws s3 sync . s3://$(BUCKET)/ --exclude "*" --include "stable.txt" endif +ifneq "$(IS_BETA)" "" + echo -n "$(RELEASE_VERSION)" > beta.txt + aws s3 sync . s3://$(BUCKET)/ --exclude "*" --include "beta.txt" +endif else echo "NOT GONNA PUBLISH" endif @@ -118,4 +125,24 @@ rebase-nightly: git reset --hard master git add . git commit --allow-empty -m "nightly" - git push $(GIT_REMOTE) HEAD:nightly \ No newline at end of file + git push $(GIT_REMOTE) HEAD:nightly + +rebase-beta: + git config --global user.email "$(GIT_EMAIL)" + git config --global user.name "$(GIT_NAME)" + git push $(GIT_REMOTE) --delete beta | true + git checkout -b beta + git reset --hard nightly + git add . + git commit --allow-empty -m "beta" + git push $(GIT_REMOTE) HEAD:beta + +release-creator: +ifeq "$(GONNA_RELEASE)" "RELEASE" + git config --global user.email "$(GIT_EMAIL)" + git config --global user.name "$(GIT_NAME)" + git checkout -b "release-$(VERSION_TO_CHECK_AGAINST)" + git add . + git commit --allow-empty -m "release-$(VERSION_TO_CHECK_AGAINST)" + git push $(GIT_REMOTE) HEAD:release-$(VERSION_TO_CHECK_AGAINST) +endif \ No newline at end of file