Only run before_deploy once during deployment

This prevents the package.json version number from doubling up no matter how many times or what order we deploy in
This commit is contained in:
Ray Schamp 2018-05-09 09:44:15 -04:00
parent af174c5782
commit 3d4b8f0a45

View file

@ -24,9 +24,14 @@ jobs:
node_js: 8 node_js: 8
env: NPM_SCRIPT=build env: NPM_SCRIPT=build
before_deploy: before_deploy:
- npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) - >
- git config --global user.email $(git log --pretty=format:"%ae" -n1) # Only run this once for both deploys (avoids weird double version number)
- git config --global user.name $(git log --pretty=format:"%an" -n1) if ![ "$BEFORE_DEPLOY_RAN" ]; then
export BEFORE_DEPLOY_RAN=1;
npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s);
git config --global user.email $(git log --pretty=format:"%ae" -n1);
git config --global user.name $(git log --pretty=format:"%an" -n1);
fi
deploy: deploy:
- provider: npm - provider: npm
skip_cleanup: true skip_cleanup: true