mirror of
https://github.com/primer/css.git
synced 2025-01-04 20:33:13 +03:00
Merge pull request #250 from primer/shawnbot/commit-status
Send commit status back after publishing canary release
This commit is contained in:
commit
b6a0b71970
@ -3,11 +3,11 @@ node_js:
|
|||||||
- 7
|
- 7
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm config set "//registry.npmjs.org/:_authToken=\${NPM_API_KEY}"
|
|
||||||
- lerna bootstrap
|
- lerna bootstrap
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm test
|
- npm test
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
- npm config set "//registry.npmjs.org/:_authToken=\${NPM_API_KEY}"
|
||||||
- script/cibuild --yes
|
- script/cibuild --yes
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
"clean": "lerna clean",
|
"clean": "lerna clean",
|
||||||
"diff": "lerna diff",
|
"diff": "lerna diff",
|
||||||
"updated": "lerna updated",
|
"updated": "lerna updated",
|
||||||
"release": "lerna publish",
|
"release-pr": "script/release-pr",
|
||||||
"release-candidate": "lerna publish --npm-tag=rc",
|
"release-candidate": "script/release-candidate",
|
||||||
"release-canary": "lerna publish --npm-tag=canary --canary",
|
"release": "script/release",
|
||||||
"test": "lerna run test"
|
"test": "lerna run test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"commit-status": "^4.1.0",
|
||||||
"lerna": "^2.0.0"
|
"lerna": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,18 +5,15 @@ set -e
|
|||||||
# which makes this easier to test locally
|
# which makes this easier to test locally
|
||||||
args=${@:1}
|
args=${@:1}
|
||||||
|
|
||||||
# always publish a canary release if this is a PR build
|
# always publish a pr release if this is a PR build
|
||||||
if [[ $TRAVIS_EVENT_TYPE = pull_request ]]; then
|
if [[ $TRAVIS_EVENT_TYPE = pull_request ]]; then
|
||||||
echo "🐦 Publishing canary version..."
|
script/release-pr ${args}
|
||||||
npm run release-canary -- ${args}
|
|
||||||
# merges to dev build a release candidate
|
# merges to dev build a release candidate
|
||||||
elif [[ $TRAVIS_BRANCH = dev ]]; then
|
elif [[ $TRAVIS_BRANCH = dev ]]; then
|
||||||
echo "👌 Publishing release candidate..."
|
script/release-candidate ${args}
|
||||||
echo npm run release-candidate -- ${args}
|
|
||||||
# publish a release when we merge to master
|
# publish a release when we merge to master
|
||||||
elif [[ $TRAVIS_BRANCH = master ]]; then
|
elif [[ $TRAVIS_BRANCH = master ]]; then
|
||||||
echo "📦 Publishing latest release!"
|
script/release ${args}
|
||||||
echo npm run release -- ${args}
|
|
||||||
else
|
else
|
||||||
echo "⚠️ This isn't a PR and '${TRAVIS_BRANCH}' isn't a release branch."
|
echo "⚠️ This isn't a PR and '${TRAVIS_BRANCH}' isn't a release branch."
|
||||||
exit 1
|
exit 1
|
||||||
|
4
script/release
Executable file
4
script/release
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
echo "📦 Publishing latest release!"
|
||||||
|
echo lerna publish
|
4
script/release-candidate
Executable file
4
script/release-candidate
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
echo "👌 Publishing release candidate..."
|
||||||
|
echo lerna publish --npm-tag=rc
|
26
script/release-pr
Executable file
26
script/release-pr
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
args=${@:1}
|
||||||
|
package=primer-css
|
||||||
|
npm_tag=pr
|
||||||
|
# the commit status context
|
||||||
|
context=npm/publish/${npm_tag}
|
||||||
|
|
||||||
|
echo "🐦 Publishing PR release to dist-tag '${npm_tag}'..."
|
||||||
|
lerna publish --npm-tag=${npm_tag} --canary --no-git ${args}
|
||||||
|
|
||||||
|
# get the published version of primer-css from its package.json
|
||||||
|
version=`jq -r .version modules/${package}/package.json`
|
||||||
|
slug="${package}@${version}"
|
||||||
|
|
||||||
|
echo "📡 Transmitting release success for ${slug} ..."
|
||||||
|
|
||||||
|
if [[ $TRAVIS_PULL_REQUEST_SHA ]]; then
|
||||||
|
# setting TRAVIS_COMMIT inline here is a fix for:
|
||||||
|
# <https://github.com/taskworld/commit-status/issues/5>
|
||||||
|
TRAVIS_COMMIT=$TRAVIS_PULL_REQUEST_SHA \
|
||||||
|
commit-status success ${context} \
|
||||||
|
"npm install ${slug}" \
|
||||||
|
"https://unpkg.com/${slug}/build/build.css"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user