Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Commit

Permalink
Fix dev NPM publish, prepare 1.0.0-m.2
Browse files Browse the repository at this point in the history
  • Loading branch information
David Dooling committed Apr 26, 2017
1 parent 9f997b7 commit 4693f35
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 16 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ deploy:
tags: true
condition: $TRAVIS_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(m|rc)\.[0-9]+)?$
after_deploy:
- bash src/main/scripts/npm-publish.bash $TRAVIS_TAG rug
- bash src/main/scripts/gh-publish.bash $TRAVIS_REPO_SLUG
before_install:
- openssl aes-256-cbc -K $encrypted_10f102c6edb5_key -iv $encrypted_10f102c6edb5_iv
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

[Unreleased]: https://github.com/atomist/rug/compare/1.0.0-m.1...HEAD
[Unreleased]: https://github.com/atomist/rug/compare/1.0.0-m.2...HEAD

## [1.0.0-m.2] - 2017-04-26

[1.0.0-m.2]: https://github.com/atomist/rug/compare/1.0.0-m.1...1.0.0-m.2

Initial milestone 2 release

### Changed

- Fix NPM publish for milestone and release candidate releases
- Consolidate NPM publish for dev and release versions

## [1.0.0-m.1] - 2017-04-26

Expand Down
38 changes: 29 additions & 9 deletions src/main/scripts/npm-publish.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,48 @@ function publish() {
shift
fi

local target="target/.atomist/node_modules/@atomist/$module_name"
local package="$target/package.json"
local target=target/.atomist/node_modules/@atomist/$module_name
local package=$target/package.json
if ! sed "s/REPLACE_ME/$module_version/g" "$package.in" > "$package"; then
err "failed to set version in $package"
return 1
fi
rm -f "$package.in"

if [[ $NPM_TOKEN ]]; then
msg "Creating local .npmrc using API key from environment"
if ! ( umask 077 && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > "$HOME/.npmrc" ); then
err "failed to create $HOME/.npmrc"
return 1
local registry
if [[ $module_version =~ ^[0-9]+\.[0-9]+\.[0-9]+-[0-9]{14}$ ]]; then
msg "publishing snapshot version $module_version"
if [[ $ATOMIST_REPO_TOKEN && $ATOMIST_REPO_USER ]]; then
msg "creating local .npmrc using auth details pulled from Artifactory"
if ! ( umask 077 && curl -s -u"$ATOMIST_REPO_USER:$ATOMIST_REPO_TOKEN" https://atomist.jfrog.io/atomist/api/npm/auth > "$HOME/.npmrc" 2>/dev/null )
then
err "failed to create $HOME/.npmrc"
return 1
fi
else
msg "assuming your .npmrc is setup correctly to publish snapshots"
fi
registry=--registry=https://atomist.jfrog.io/atomist/api/npm/npm-dev-local
elif [[ $module_version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(m|rc)\.[0-9]+)?$ ]]; then
msg "publishing release version $module_version"
if [[ $NPM_TOKEN ]]; then
msg "creating local .npmrc using NPM token from environment"
if ! ( umask 077 && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > "$HOME/.npmrc" ); then
err "failed to create $HOME/.npmrc"
return 1
fi
else
msg "assuming your .npmrc is setup correctly to publish to npmjs.org"
fi
else
msg "assuming your .npmrc is setup correctly for this project"
err "not publishing invalid version: $module_version"
return 1
fi

# npm honors this
rm -f "$target/.gitignore"

if ! ( cd "$target" && npm publish --access=public ); then
if ! ( cd "$target" && npm publish --access=public $registry ); then
err "failed to publish node module"
cat "$target/npm-debug.log"
return 1
Expand Down
8 changes: 3 additions & 5 deletions src/main/scripts/travis-build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ function main() {
return 1
fi

if [[ $TRAVIS_BRANCH == master ]]; then
if ! src/main/scripts/npm-publish-dev.bash $project_version rug; then
err "npm publish to dev repo failed"
return 1
fi
if ! bash src/main/scripts/npm-publish.bash "$project_version" rug; then
err "npm publish to dev repo failed"
return 1
fi

if ! git config --global user.email "travis-ci@atomist.com"; then
Expand Down

0 comments on commit 4693f35

Please sign in to comment.