From b043a42a06a7e53b104600b8cc45f43decc969b7 Mon Sep 17 00:00:00 2001 From: Guillermo Vaya Date: Mon, 17 Feb 2020 12:24:17 +0100 Subject: [PATCH] Add message notifications to releases --- .circleci/config.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index dfc48155..c2ab15cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,6 +27,32 @@ executors: docker: - image: circleci/golang:1.12 commands: + notify: + description: "notify on release channel" + parameters: + message: + type: string + default: "This is the default notification message, someone forgot to add info on what to notify!" + username: + type: string + default: "MattermostRelease" + icon: + type: string + default: "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png" + steps: + - run: + command: | + export VERSION=$(jq -r .version package.json) + echo "payload=" > /tmp/webhook-data.json; + echo '{}' | jq "{ + \"username\": \"<< parameters.username >>\", + \"icon_url\": \"<< parameters.icon >>\", + \"text\": \"[${VERSION}] << parameters.message >>\" + }" >> /tmp/webhook-data.json + - run: + command: | + curl -i -X POST -d @/tmp/webhook-data.json $MATTERMOST_RELEASE_WEBHOOK_URL_DESKTOP || echo "NOFICATION FAILED! check logs as this will succeed intentionally" + update_image: description: "Update base image" parameters: @@ -277,11 +303,39 @@ jobs: -delete \ v${VERSION} ./ghr-dist + begin-notification: + executor: wine-chrome + steps: + - checkout + - update_image: + apt_opts: "--no-install-recommends jq" + - notify: + message: "Release process for the desktop app has started, it should take about 30 minutes to complete." + + end-notification: + executor: wine-chrome + steps: + - checkout + - update_image: + apt_opts: "--no-install-recommends jq" + - notify: + message: "Release process for the desktop app ended, new release can be found on (github's releases)[https://github.com/mattermost/desktop/releases]" + + workflows: version: 2 build_and_test: jobs: - check + - begin-notification: + context: desktop-notify + filters: + branches: + only: + # only for release and release candidates + # release-XX.YY.ZZ + # release-XX.YY.ZZ-rc-something + - /^release-\d+(\.\d+){1,2}(-rc.*)?/ - build-linux: requires: - check @@ -354,3 +408,14 @@ workflows: branches: only: - /^release-\d+(\.\d+){1,2}(-rc.*)?/ + - end-notification: + requires: + - upload_to_github + context: desktop-notify + filters: + branches: + only: + # only for release and release candidates + # release-XX.YY.ZZ + # release-XX.YY.ZZ-rc-something + - /^release-\d+(\.\d+){1,2}(-rc.*)?/