Monty Taylor 20f7528a09
Add upload-npm role
We need a role for uploading content to npm. The old script assumed a
global npm install - but as this runs on the executor we shouldn't
assume that. Use nvm to install node into the work_dir and use the npm
from that node installation.

Change-Id: I7f7c031ce754838776043325025fe5928cd36135
2017-10-09 15:41:20 -05:00

22 lines
555 B
YAML

# This is not optimized, but allows for getting a version of node in the
# home dir.
- name: Create .npmrc configuration file
template:
dest: "~/.npmrc"
mode: 0400
src: .npmrc.j2
- name: Install NVM
git:
repo: 'https://github.com/creationix/nvm'
dest: '~/.nvm'
version: v0.33.5
- name: Upload tarball to npm
shell:
executable: /bin/bash
cmd: |
nvm install node
nvm use node
npm publish --ignore-scripts {{ zuul.executor.work_dir }}/artifacts/{{ zuul.project.short_name }}-{{ project_ver }}.tar.gz