|
| 1 | +version: 2.1 |
| 2 | +orbs: |
| 3 | + node: circleci/node@5 |
| 4 | +commands: |
| 5 | + deploy_npm: |
| 6 | + steps: |
| 7 | + - run: |
| 8 | + # This assumes the git user info is already configured |
| 9 | + name: Deploy to NPM |
| 10 | + command: | |
| 11 | + export RELEASE_VERSION="0.11.$(date +%Y%m%d%H%M%S)" |
| 12 | + if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then |
| 13 | + export NPM_TAG=hotfix |
| 14 | + else |
| 15 | + export NPM_TAG=latest |
| 16 | + fi |
| 17 | + echo "Deploying version $RELEASE_VERSION to $NPM_TAG" |
| 18 | + npm --no-git-tag-version version $RELEASE_VERSION |
| 19 | + npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN |
| 20 | + npm publish --tag $NPM_TAG |
| 21 | + if npm info | grep -q $RELEASE_VERSION; then |
| 22 | + git tag $RELEASE_VERSION |
| 23 | + git push \ |
| 24 | + https://${GH_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git \ |
| 25 | + $RELEASE_VERSION |
| 26 | + fi |
| 27 | +
|
| 28 | +jobs: |
| 29 | + default: |
| 30 | + docker: |
| 31 | + - image: circleci/node:10-browsers # TODO: switch to cimg/node:* after upgrading gulp |
| 32 | + steps: |
| 33 | + - checkout |
| 34 | + - run: git submodule update --init --recursive |
| 35 | + - run: |
| 36 | + name: Setup |
| 37 | + command: | |
| 38 | + sudo apt update |
| 39 | + sudo apt install libgif-dev |
| 40 | + TRAVIS_BRANCH="${CIRCLECI_BRANCH}" travis/setup-git.sh # Configure git user info |
| 41 | + travis/install-assets.sh |
| 42 | + npm set progress=false |
| 43 | + which gulp || sudo npm install -g gulp-cli |
| 44 | + - node/install-packages |
| 45 | + - run: gulp jshint |
| 46 | + - run: gulp minify |
| 47 | + - run: gulp test |
| 48 | + - run: gulp zip |
| 49 | + - when: |
| 50 | + condition: |
| 51 | + or: |
| 52 | + - equal: [ master, <<pipeline.git.branch>> ] |
| 53 | + - equal: [ develop, <<pipeline.git.branch>> ] |
| 54 | + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } |
| 55 | + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } |
| 56 | + steps: |
| 57 | + - run: |
| 58 | + name: travis/deploy-prebuilt.sh |
| 59 | + command: | |
| 60 | + TRAVIS_TAG="${CIRCLE_TAG}" TRAVIS_COMMIT="${CIRCLE_SHA1}" travis/deploy-prebuilt.sh |
| 61 | + - deploy_npm |
| 62 | +workflows: |
| 63 | + version: 2 |
| 64 | + default: |
| 65 | + jobs: |
| 66 | + - default: |
| 67 | + context: |
| 68 | + - dockerhub-credentials |
| 69 | + - scratch-npm-creds |
0 commit comments