File tree Expand file tree Collapse file tree 5 files changed +7848
-1061
lines changed Expand file tree Collapse file tree 5 files changed +7848
-1061
lines changed Original file line number Diff line number Diff line change 1+
2+ #! /bin/bash
3+
4+ # write npm run output both to console and to build.log
5+ npm run build 2>&1 | tee build.log
6+ build_status=${PIPESTATUS[0]}
7+
8+ # if exist status from the npm run build is not 0
9+ # then exit with the status code from the npm run build
10+ if [ $build_status -ne 0 ]; then
11+ echo " Build failed. Exiting with status code $build_status "
12+ exit $build_status
13+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -x
4+
5+ COMMIT_SHORT_SHA=$( echo $CI_COMMIT_SHA | cut -c1-8)
6+
7+
8+ if [ " $CI_PREV_PIPELINE_STATUS " = " success" ]; then
9+ MESSAGE=" Did a build without issues on \` $CI_REPO_NAME /$CI_COMMIT_BRANCH \` . Commit: _${CI_COMMIT_MESSAGE} _ (<$CI_COMMIT_URL |$COMMIT_SHORT_SHA >)"
10+
11+ curl -s -X POST -H " Content-Type: application/json" -d ' {
12+ "username": "' " $CI_COMMIT_AUTHOR " ' ",
13+ "icon_url": "' " $CI_COMMIT_AUTHOR_AVATAR " ' ",
14+ "attachments": [
15+ {
16+ "mrkdwn_in": ["text", "pretext"],
17+ "color": "#36a64f",
18+ "text": "' " $MESSAGE " ' "
19+ }
20+ ]
21+ }' " $DEVELOPERS_SLACK_WEBHOOK "
22+ exit 0
23+ fi
24+ export BUILD_LOG=$( cat ./build.log)
25+
26+ BUILD_LOG=$( echo $BUILD_LOG | sed ' s/"/\\"/g' )
27+
28+ MESSAGE=" Broke \` $CI_REPO_NAME /$CI_COMMIT_BRANCH \` with commit _${CI_COMMIT_MESSAGE} _ (<$CI_COMMIT_URL |$COMMIT_SHORT_SHA >)"
29+ CODE_BLOCK=" \`\`\` $BUILD_LOG \n\`\`\` "
30+
31+ echo " Sending slack message to developers $MESSAGE "
32+ # Send the message
33+ curl -sS -X POST -H " Content-Type: application/json" -d ' {
34+ "username": "' " $CI_COMMIT_AUTHOR " ' ",
35+ "icon_url": "' " $CI_COMMIT_AUTHOR_AVATAR " ' ",
36+ "attachments": [
37+ {
38+ "mrkdwn_in": ["text", "pretext"],
39+ "color": "#8A1C12",
40+ "text": "' " $CODE_BLOCK " ' ",
41+ "pretext": "' " $MESSAGE " ' "
42+ }
43+ ]
44+ }' " $DEVELOPERS_SLACK_WEBHOOK " 2>&1
Original file line number Diff line number Diff line change 1+ clone :
2+ git :
3+ image : woodpeckerci/plugin-git
4+ settings :
5+ partial : false
6+ depth : 5
7+
8+ steps :
9+ init-secrets :
10+ when :
11+ - event : push
12+ image : infisical/cli
13+ environment :
14+ INFISICAL_TOKEN :
15+ from_secret : VAULT_TOKEN
16+ commands :
17+ - infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
18+
19+ release :
20+ image : node:20
21+ when :
22+ - event : push
23+ commands :
24+ - apt update && apt install -y rsync
25+ - export $(cat /woodpecker/deploy.vault.env | xargs)
26+ - npm clean-install
27+ - /bin/bash ./.woodpecker/buildRelease.sh
28+ - npm audit signatures
29+ - npx semantic-release
30+
31+ slack-on-failure :
32+ when :
33+ - event : push
34+ status : [failure, success]
35+ - event : push
36+ image : curlimages/curl
37+ commands :
38+ - export $(cat /woodpecker/deploy.vault.env | xargs)
39+ - /bin/sh ./.woodpecker/buildSlackNotify.sh
40+
You can’t perform that action at this time.
0 commit comments