Add message notifications to releases

This commit is contained in:
Guillermo Vaya 2020-02-17 12:24:17 +01:00 committed by William Gathoye
parent 6e1d8b9c46
commit b043a42a06

View file

@ -27,6 +27,32 @@ executors:
docker: docker:
- image: circleci/golang:1.12 - image: circleci/golang:1.12
commands: 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: update_image:
description: "Update base image" description: "Update base image"
parameters: parameters:
@ -277,11 +303,39 @@ jobs:
-delete \ -delete \
v${VERSION} ./ghr-dist 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: workflows:
version: 2 version: 2
build_and_test: build_and_test:
jobs: jobs:
- check - 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: - build-linux:
requires: requires:
- check - check
@ -354,3 +408,14 @@ workflows:
branches: branches:
only: only:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/ - /^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.*)?/