deploy-notify-slack 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/bitbucket-pipelines.yml +0 -2
- package/notify.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
|
|
22
22
|
- In Bitbucket pipeline or another place you wish to notify about just deployed version of your application you can add dev dependency
|
|
23
23
|
```shell
|
|
24
|
-
|
|
24
|
+
npm i --no-save deploy-notify-slack@^0.1
|
|
25
25
|
```
|
|
26
26
|
or major version
|
|
27
27
|
```shell
|
|
28
|
-
|
|
28
|
+
npm i --location=global deploy-notify-slack@^0.1
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
- run the scrypt with your env variables:
|
|
@@ -39,11 +39,11 @@ Bitbucket pipeline example:
|
|
|
39
39
|
name: Notify deploy
|
|
40
40
|
image: node:16-alpine
|
|
41
41
|
script:
|
|
42
|
-
-
|
|
43
|
-
- npm i --no-save git@bitbucket.org:omvmike/deploy-notify-slack.git#semver:^0.1
|
|
42
|
+
- npm i --location=global deploy-notify-slack@^0.1
|
|
44
43
|
- VERSION=$(npm run version --silent)
|
|
45
44
|
- SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL} STAGE=dev VERSION=$VERSION node ./node_modules/deploy-notify-slack/notify
|
|
46
45
|
```
|
|
46
|
+
|
|
47
47
|
or install package globally
|
|
48
48
|
|
|
49
49
|
```yaml
|
|
@@ -51,12 +51,13 @@ or install package globally
|
|
|
51
51
|
name: Notify Slack
|
|
52
52
|
image: node:16-alpine
|
|
53
53
|
script:
|
|
54
|
-
-
|
|
55
|
-
- npm i --location=global git@bitbucket.org:omvmike/deploy-notify-slack.git#semver:^0.1
|
|
54
|
+
- npm i --location=global deploy-notify-slack@^0.1
|
|
56
55
|
- VERSION=$(npm run version --silent)
|
|
57
56
|
- PWD=$(pwd)
|
|
58
57
|
- SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL} STAGE=dev VERSION=$VERSION CHANGELOG_PATH=$PWD/changelog node /usr/local/lib/node_modules/deploy-notify-slack/notify.js
|
|
59
58
|
```
|
|
59
|
+
> version script above is just a `echo $npm_package_version` command
|
|
60
|
+
|
|
60
61
|
|
|
61
62
|
Full bitbucket CI/CD pipeline example for deploy NestJs application and send deploy message:
|
|
62
63
|
```yaml
|
|
@@ -99,8 +100,7 @@ pipelines:
|
|
|
99
100
|
name: Notify Slack
|
|
100
101
|
image: node:16-alpine
|
|
101
102
|
script:
|
|
102
|
-
-
|
|
103
|
-
- npm i --location=global git@bitbucket.org:omvmike/deploy-notify-slack.git#semver:^0.1
|
|
103
|
+
- npm i --location=global deploy-notify-slack@^0.1
|
|
104
104
|
- VERSION=$(npm run version --silent)
|
|
105
105
|
- SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL} STAGE=dev VERSION=$VERSION node /usr/local/lib/node_modules/deploy-notify-slack/notify.js
|
|
106
106
|
|
package/bitbucket-pipelines.yml
CHANGED
package/notify.js
CHANGED
|
@@ -12,8 +12,14 @@ function getChangelog() {
|
|
|
12
12
|
try {
|
|
13
13
|
return fs.readFileSync(path.join(changelogPath, `${stage}-v${version}.md`), 'utf8')
|
|
14
14
|
} catch (e) {
|
|
15
|
-
|
|
15
|
+
console.log(`Description "${stage}-v${version}.md" not found`)
|
|
16
16
|
}
|
|
17
|
+
try {
|
|
18
|
+
return fs.readFileSync(path.join(changelogPath, `v${version}.md`), 'utf8')
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.log(`Description "v${version}.md" not found`)
|
|
21
|
+
}
|
|
22
|
+
return '';
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
function notificationBody() {
|