File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ npm run build 2>&1 | tee build.log
4+ build_status=${PIPESTATUS[0]}
5+
6+ if [ $build_status -ne 0 ]; then
7+ echo " Build failed. Exiting with status code $build_status "
8+ exit $build_status
9+ 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+ STATUS=${1}
8+
9+ if [ " $STATUS " = " success" ]; then
10+ MESSAGE=" Did a build without issues on \` $CI_REPO_NAME /$CI_COMMIT_BRANCH \` . Commit: _${CI_COMMIT_MESSAGE} _ (<$CI_COMMIT_URL |$COMMIT_SHORT_SHA >)"
11+
12+ curl -s -X POST -H " Content-Type: application/json" -d ' {
13+ "username": "' " $CI_COMMIT_AUTHOR " ' ",
14+ "icon_url": "' " $CI_COMMIT_AUTHOR_AVATAR " ' ",
15+ "attachments": [
16+ {
17+ "mrkdwn_in": ["text", "pretext"],
18+ "color": "#36a64f",
19+ "text": "' " $MESSAGE " ' "
20+ }
21+ ]
22+ }' " $DEVELOPERS_SLACK_WEBHOOK "
23+ exit 0
24+ fi
25+ export BUILD_LOG=$( cat ./build.log)
26+
27+ BUILD_LOG=$( echo $BUILD_LOG | sed ' s/"/\\"/g' )
28+
29+ MESSAGE=" Broke \` $CI_REPO_NAME /$CI_COMMIT_BRANCH \` with commit _${CI_COMMIT_MESSAGE} _ (<$CI_COMMIT_URL |$COMMIT_SHORT_SHA >)"
30+ CODE_BLOCK=" \`\`\` $BUILD_LOG \n\`\`\` "
31+
32+ echo " Sending slack message to developers $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+ build :
20+ image : devforth/node20-pnpm:latest
21+ when :
22+ - event : push
23+ commands :
24+ - . /woodpecker/deploy.vault.env
25+ - pnpm install
26+ - /bin/bash ./.woodpecker/buildRelease.sh
27+ - npm audit signatures
28+
29+ release :
30+ image : devforth/node20-pnpm:latest
31+ when :
32+ - event :
33+ - push
34+ branch :
35+ - main
36+ commands :
37+ - . /woodpecker/deploy.vault.env
38+ - pnpm exec semantic-release
39+
40+ slack-on-failure :
41+ image : curlimages/curl
42+ when :
43+ - event : push
44+ status : [failure]
45+ commands :
46+ - . /woodpecker/deploy.vault.env
47+ - /bin/sh ./.woodpecker/buildSlackNotify.sh failure
48+
49+ slack-on-success :
50+ image : curlimages/curl
51+ when :
52+ - event : push
53+ status : [success]
54+ commands :
55+ - . /woodpecker/deploy.vault.env
56+ - /bin/sh ./.woodpecker/buildSlackNotify.sh success
Original file line number Diff line number Diff line change 44 "main" : " dist/index.js" ,
55 "types" : " dist/index.d.ts" ,
66 "type" : " module" ,
7+ "publishConfig" : {
8+ "access" : " public"
9+ },
710 "scripts" : {
8- "build" : " tsc && npm version patch" ,
9- "rollout" : " npm run build && npm publish --access public"
11+ "build" : " tsc"
1012 },
1113 "keywords" : [],
1214 "author" : " DevForth (https://devforth.io)" ,
1315 "license" : " MIT" ,
1416 "description" : " " ,
17+ "devDependencies" : {
18+ "semantic-release" : " ^24.2.1" ,
19+ "semantic-release-slack-bot" : " ^4.0.2"
20+ },
1521 "dependencies" : {
1622 "axios" : " ^1.9.0" ,
1723 "file-type" : " ^20.5.0" ,
1824 "typescript" : " ^5.8.3"
1925 },
2026 "peerDependencies" : {
2127 "adminforth" : " ^2.24.0"
28+ },
29+ "release" : {
30+ "plugins" : [
31+ " @semantic-release/commit-analyzer" ,
32+ " @semantic-release/release-notes-generator" ,
33+ " @semantic-release/npm" ,
34+ " @semantic-release/github" ,
35+ [
36+ " semantic-release-slack-bot" ,
37+ {
38+ "packageName" : " @adminforth/login-captcha-adapter-cloudflare" ,
39+ "notifyOnSuccess" : true ,
40+ "notifyOnFail" : true ,
41+ "slackIcon" : " :package:" ,
42+ "markdownReleaseNotes" : true
43+ }
44+ ]
45+ ],
46+ "branches" : [
47+ " main" ,
48+ {
49+ "name" : " next" ,
50+ "prerelease" : true
51+ }
52+ ]
2253 }
2354}
You can’t perform that action at this time.
0 commit comments