Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: deploy npm package automatically on CI #24

Merged
merged 1 commit into from Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 15 additions & 10 deletions .travis.yml
Expand Up @@ -31,16 +31,21 @@ after_success:
before_deploy: yarn build:example --public-url /$TRAVIS_REPO_NAME/

deploy:
provider: pages
skip_cleanup: true
email: admin@1stg.me
name: JounQin
github_token: $GH_TOKEN
keep_history: true
allow_empty_commit: false
local_dir: output
edge:
branch: master
- provider: script
skip_cleanup: true
script: bash deploy.sh
edge:
branch: master
- provider: pages
skip_cleanup: true
email: admin@1stg.me
name: JounQin
github_token: $GH_TOKEN
keep_history: true
allow_empty_commit: false
local_dir: output
edge:
branch: master

after_script:
- yarn add -D @codechecks/client @codechecks/build-size-watcher @codechecks/commit-deployment @codechecks/type-coverage-watcher
Expand Down
5 changes: 5 additions & 0 deletions .versionrc
@@ -0,0 +1,5 @@
{
"skip": {
"bump": true
}
}
20 changes: 20 additions & 0 deletions deploy.sh
@@ -0,0 +1,20 @@
#!/bin/sh

set -e

git remote set-url origin "https://user:$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git"
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"

git fetch origin "$TRAVIS_BRANCH":"$TRAVIS_BRANCH"
git checkout "$TRAVIS_BRANCH"

cd dist

PKG_VERSION=$(jq -r '.version' package.json)

git fetch origin v"$PKG_VERSION" || {
yarn add -D standard-version
yarn run standard-version -a --release-as "$PKG_VERSION"
git push --follow-tags origin "$TRAVIS_BRANCH"
npm publish --access=public
}
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "stated-bean",
"version": "0.1.1-alpha.1",
"version": "0.1.1-alpha.2",
"repository": "git@github.com:mjolnirjs/stated-bean.git",
"license": "MIT",
"main": "dist/cjs",
Expand Down