Skip to content

Commit 328a0a4

Browse files
authored
Merge pull request #246 from primer/after_success
Trigger canary release on successful PR build
2 parents 9424479 + 0ce097e commit 328a0a4

File tree

5 files changed

+64
-36
lines changed

5 files changed

+64
-36
lines changed

.travis.yml

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
language: node_js
22
node_js:
3-
- '7'
4-
env:
5-
- TEST_DIR=modules/primer-css
6-
- TEST_DIR=modules/primer-core
7-
- TEST_DIR=modules/primer-product
8-
- TEST_DIR=modules/primer-marketing
9-
- TEST_DIR=modules/primer-alerts
10-
- TEST_DIR=modules/primer-base
11-
- TEST_DIR=modules/primer-blankslate
12-
- TEST_DIR=modules/primer-box
13-
- TEST_DIR=modules/primer-breadcrumb
14-
- TEST_DIR=modules/primer-buttons
15-
- TEST_DIR=modules/primer-cards
16-
- TEST_DIR=modules/primer-forms
17-
- TEST_DIR=modules/primer-labels
18-
- TEST_DIR=modules/primer-layout
19-
- TEST_DIR=modules/primer-markdown
20-
- TEST_DIR=modules/primer-marketing
21-
- TEST_DIR=modules/primer-marketing-type
22-
- TEST_DIR=modules/primer-marketing-utilities
23-
- TEST_DIR=modules/primer-navigation
24-
- TEST_DIR=modules/primer-page-headers
25-
- TEST_DIR=modules/primer-page-sections
26-
- TEST_DIR=modules/primer-support
27-
- TEST_DIR=modules/primer-table-object
28-
- TEST_DIR=modules/primer-tables
29-
- TEST_DIR=modules/primer-tooltips
30-
- TEST_DIR=modules/primer-truncate
31-
- TEST_DIR=modules/primer-utilities
32-
script: cd $TEST_DIR && npm install && npm test
3+
- 7
4+
5+
before_script:
6+
- npm config set "//registry.npmjs.org/:_authToken=\${NPM_API_KEY}"
7+
- lerna bootstrap
8+
9+
script:
10+
- npm test
11+
12+
after_success:
13+
- script/cibuild --yes

modules/primer-utilities/lib/padding.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
}
6868

6969
// responsive padding for containers
70+
// stylelint-disable-next-line primer/selector-no-utility
7071
.p-responsive {
7172
padding-right: $spacer-3 !important;
7273
padding-left: $spacer-3 !important;

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"scripts": {
44
"bootstrap": "lerna bootstrap",
55
"clean": "lerna clean",
6-
"updated": "lerna updated",
76
"diff": "lerna diff",
8-
"publish": "lerna publish",
9-
"dev": "lerna publish --npm-tag=dev --skip-git",
10-
"rc": "lerna publish --npm-tag=rc --skip-git",
11-
"force": "lerna publish --force-publish=*"
7+
"updated": "lerna updated",
8+
"release": "lerna publish",
9+
"release-candidate": "lerna publish --npm-tag=rc",
10+
"release-canary": "lerna publish --npm-tag=canary --canary",
11+
"test": "lerna run test"
1212
},
1313
"devDependencies": {
14-
"lerna": "^2.0.0-rc.5"
14+
"lerna": "^2.0.0"
1515
}
1616
}

script/cibuild

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# --yes gets passed in by .travis.yml,
5+
# which makes this easier to test locally
6+
args=${@:1}
7+
8+
# always publish a canary release if this is a PR build
9+
if [[ $TRAVIS_EVENT_TYPE = pull_request ]]; then
10+
echo "🐦 Publishing canary version..."
11+
npm run release-canary -- ${args}
12+
# merges to dev build a release candidate
13+
elif [[ $TRAVIS_BRANCH = dev ]]; then
14+
echo "👌 Publishing release candidate..."
15+
echo npm run release-candidate -- ${args}
16+
# publish a release when we merge to master
17+
elif [[ $TRAVIS_BRANCH = master ]]; then
18+
echo "📦 Publishing latest release!"
19+
echo npm run release -- ${args}
20+
else
21+
echo "⚠️ This isn't a PR and '${TRAVIS_BRANCH}' isn't a release branch."
22+
exit 1
23+
fi

script/compare-published

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# reads the tag either from $NPM_TAG or first positional arg:
5+
# script/compare-published [tag]
6+
tag=${1:-${NPM_TAG:-latest}}
7+
8+
# this is way faster than `lerna exec npm info . .name`
9+
# (but will skip modules that don't have "primer-" in them)
10+
modules=`ls -1 modules | egrep primer-`
11+
12+
# tabular output separator for column(1)
13+
s=,
14+
15+
echo "📦 Comparing Primer modules published @${tag}..."
16+
(
17+
echo "module${s}tag${s}published${s}local"
18+
for module in $modules; do
19+
v_published=`npm info ${module}@${tag} .version`
20+
v_local=`jq -Mr .version modules/${module}/package.json`
21+
echo "${module}${s}${tag}${s}${v_published:-x}${s}${v_local}"
22+
done
23+
) | column -t -s=${s}

0 commit comments

Comments
 (0)