deploy-notify-slack 0.1.11 → 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 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
- npm i --no-save git@bitbucket.org:omvmike/deploy-notify-slack.git#semver:latest
24
+ npm i --no-save deploy-notify-slack@^0.1
25
25
  ```
26
26
  or major version
27
27
  ```shell
28
- npm i --no-save git@bitbucket.org:omvmike/deploy-notify-slack.git#semver:^0.1
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
- - apk add --no-cache bash git openssh
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
- - apk add --no-cache bash git openssh
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
- - apk add --no-cache bash git openssh
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
 
@@ -11,8 +11,6 @@ pipelines:
11
11
  name: Publish
12
12
  deployment: production
13
13
  script:
14
- # - npm version from-git -m "Upgrade to %s [skip ci]"
15
- # - git push && git push --tags
16
14
  - pipe: atlassian/npm-publish:0.2.0
17
15
  variables:
18
16
  NPM_TOKEN: $NPM_TOKEN
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
- return '';
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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deploy-notify-slack",
3
- "version": "0.1.11",
3
+ "version": "0.2.1",
4
4
  "description": "Send Slack notification about deploy with version comments",
5
5
  "main": "notify.js",
6
6
  "scripts": {