File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ set -x
34
45COMMIT_SHORT_SHA=$( echo $CI_COMMIT_SHA | cut -c1-8)
56
7+ STATUS=${1}
68
7- if [ " $CI_STEP_STATUS " = " success" ]; then
9+
10+ if [ " $STATUS " = " success" ]; then
811 MESSAGE=" Did a build without issues on \` $CI_REPO_NAME /$CI_COMMIT_BRANCH \` . Commit: _${CI_COMMIT_MESSAGE} _ (<$CI_COMMIT_URL |$COMMIT_SHORT_SHA >)"
912
1013 curl -s -X POST -H " Content-Type: application/json" -d ' {
@@ -22,13 +25,14 @@ if [ "$CI_STEP_STATUS" = "success" ]; then
2225fi
2326export BUILD_LOG=$( cat ./build.log)
2427
28+ BUILD_LOG=$( echo $BUILD_LOG | sed ' s/"/\\"/g' )
2529
2630MESSAGE=" Broke \` $CI_REPO_NAME /$CI_COMMIT_BRANCH \` with commit _${CI_COMMIT_MESSAGE} _ (<$CI_COMMIT_URL |$COMMIT_SHORT_SHA >)"
2731CODE_BLOCK=" \`\`\` $BUILD_LOG \n\`\`\` "
2832
2933echo " Sending slack message to developers $MESSAGE "
3034# Send the message
31- curl -X POST -H " Content-Type: application/json" -d ' {
35+ curl -sS -X POST -H " Content-Type: application/json" -d ' {
3236 "username": "' " $CI_COMMIT_AUTHOR " ' ",
3337 "icon_url": "' " $CI_COMMIT_AUTHOR_AVATAR " ' ",
3438 "attachments": [
@@ -39,4 +43,4 @@ curl -X POST -H "Content-Type: application/json" -d '{
3943 "pretext": "' " $MESSAGE " ' "
4044 }
4145 ]
42- }' " $DEVELOPERS_SLACK_WEBHOOK "
46+ }' " $DEVELOPERS_SLACK_WEBHOOK " 2>&1
Original file line number Diff line number Diff line change @@ -16,28 +16,42 @@ steps:
1616 commands :
1717 - infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
1818
19- release :
19+ build :
2020 image : node:20
2121 when :
2222 - event : push
23- volumes :
24- - /var/run/docker.sock:/var/run/docker.sock
2523 commands :
26- # install rsync
2724 - apt update && apt install -y rsync
28- - export $(cat /woodpecker/deploy.vault.env | xargs)
25+ - . /woodpecker/deploy.vault.env
2926 - npm clean-install
3027 - /bin/bash ./.woodpecker/buildRelease.sh
3128 - npm audit signatures
29+
30+ release :
31+ image : node:20
32+ when :
33+ - event :
34+ - push
35+ branch :
36+ - main
37+ commands :
38+ - . /woodpecker/deploy.vault.env
3239 - npx semantic-release
3340
3441 slack-on-failure :
42+ image : curlimages/curl
3543 when :
3644 - event : push
37- status : [failure, success]
38- - event : push
45+ status : [failure]
46+ commands :
47+ - . /woodpecker/deploy.vault.env
48+ - /bin/sh ./.woodpecker/buildSlackNotify.sh failure
49+
50+ slack-on-success :
3951 image : curlimages/curl
52+ when :
53+ - event : push
54+ status : [success]
4055 commands :
41- - export $(cat /woodpecker/deploy.vault.env | xargs)
42- - /bin/sh ./.woodpecker/buildSlackNotify.sh
43-
56+ - . /woodpecker/deploy.vault.env
57+ - /bin/sh ./.woodpecker/buildSlackNotify.sh success
You can’t perform that action at this time.
0 commit comments