Skip to content

Commit ce54470

Browse files
committed
Modifying notify script to publish from each package
1 parent df7a882 commit ce54470

File tree

6 files changed

+19
-39
lines changed

6 files changed

+19
-39
lines changed

modules/primer-alerts/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
"build": "../../script/npm-run primer-module-build index.scss",
2929
"prepare": "npm run build",
3030
"lint": "../../script/lint-scss",
31-
"test": "../../script/npm-run-all build lint"
31+
"test": "../../script/npm-run-all build lint",
32+
"prepublishOnly": "../../script/notify pending",
33+
"publish": "../../script/notify success"
3234
},
3335
"dependencies": {
3436
"primer-support": "4.5.4"

modules/primer/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"build": "../../script/npm-run primer-module-build index.scss",
2626
"prepare": "npm run build",
2727
"lint": "../../script/lint-scss",
28-
"test": "../../script/npm-run-all build lint"
28+
"test": "../../script/npm-run-all build lint",
29+
"prepublishOnly": "../../script/notify pending",
30+
"publish": "../../script/notify success"
2931
},
3032
"dependencies": {
3133
"primer-alerts": "1.5.7",

script/notify

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,28 @@
22
set -e
33

44
if [[ "$CI" != "true" ]]; then
5-
echo "(notify bailing: not in CI)"
5+
echo "(bailing: not in CI)"
66
exit
77
elif [[ $# -lt 1 ]]; then
88
echo "No status provided!" >&2
99
exit 1
1010
fi
1111

12-
# the commit status context
13-
context="npm publish"
14-
_status=$1
15-
16-
# get the published version of primer from its package.json
17-
package=primer
18-
version=$(jq -r .version modules/$package/package.json)
19-
published="$package@$version"
20-
21-
message=""
22-
if [[ "$_status" = "success" ]]; then
23-
# TODO point this at the contributing docs!
24-
message="https://unpkg.com/$published/build/build.css"
25-
fi
26-
2712
# XXX this will go away if we build pushes instead of PRs
2813
if [[ "$TRAVIS_PULL_REQUEST_SHA" != "" ]]; then
2914
# setting TRAVIS_COMMIT inline here is a fix for:
3015
# <https://github.com/taskworld/commit-status/issues/5>
3116
export TRAVIS_COMMIT=$TRAVIS_PULL_REQUEST_SHA
3217
fi
3318

34-
echo "📡 Transmitting publish status for $published..."
35-
commit-status "$_status" "$context" "$published" "$message"
19+
_status=$1
20+
21+
version=$(jq -r .version package.json)
22+
name=$(jq -r .name package.json)
23+
24+
# the commit status context
25+
context="npm publish $name"
26+
message="https://unpkg.com/$name@$version/"
27+
28+
echo "📡 Transmitting publish status for $context $name@$version..."
29+
commit-status "$_status" "$context" "$name@$version" "$message"

script/release

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
set -e
33
echo "📦 Publishing latest release..."
44

5-
$(dirname $0)/notify pending
6-
75
# note: try-publish should exit cleanly if it detects a duplicate
86
# published version
97
$(npm bin)/lerna exec -- $(pwd)/script/try-publish
108

119
echo "📓 Updated CHANGELOG..."
1210

1311
$(npm bin)/lerna-changelog
14-
15-
$(dirname $0)/notify success

script/release-candidate

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ const getUpdated = (args) => {
3939
.then(updated => updated.map(pkg => pkg.name))
4040
}
4141

42-
const notify = status => {
43-
return execa('script/notify', [status], {env: process.env})
44-
.catch(error => {
45-
console.error('notify error:', error)
46-
})
47-
}
48-
4942
const writePackage = (pkg) => {
5043
const {dir} = pkg
5144
delete pkg.dir
@@ -152,12 +145,11 @@ revertPackages()
152145
console.error('lerna-changelog error:', error)
153146
})
154147
})
155-
.then(() => notify('success'))
156148
})
157149
})
158150
.catch(error => {
159151
console.error('Error:', error)
160152
process.exitCode = 1
161-
return notify('error')
153+
return
162154
})
163155
.then(() => process.exit())

script/release-pr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
set -e
33
echo "🐦 Publishing PR (canary) release..."
44

5-
# don't notify of a pending publish event because the version will differ from
6-
# what lerna creates as a canary release
7-
# $(dirname $0)/notify pending
8-
95
$(npm bin)/lerna publish --npm-tag=pr --canary --exact $@
106

117
echo "📓 Updated CHANGELOG..."
128

139
$(npm bin)/lerna-changelog
14-
15-
$(dirname $0)/notify success

0 commit comments

Comments
 (0)