diff --git a/.circleci/config.yml b/.circleci/config.yml index 36ac593..aa3a3aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,8 +44,8 @@ jobs: - run: name: Install Server Dependencies Prod command: | - rm -rf server/node_modules - cd server; npm install --production + rm -rf server/node_modules + cd server; npm install --production # BUILD: CLIENT - run: @@ -61,23 +61,23 @@ jobs: - run: name: Run Docker Build command: | - VERSION=$(node -p -e "require('./server/package.json').version") - # pack application - rm -rf server/public; mv ./client/dist ./server/public - cd server && tar -czf ../stjorna-$VERSION.tar.gz * - docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} docker.io - cd ../ && docker build --pull --build-arg VERSION=$VERSION -t docker.io/secanis/stjorna:$VERSION -t docker.io/secanis/stjorna:latest -t docker.io/secanis/stjorna:dev-${CIRCLE_BRANCH/\//-} . - # docker build: if RELEASE then push it - if [ -n "$RELEASE" ]; then - # docker push - docker push docker.io/secanis/stjorna:$VERSION - docker push docker.io/secanis/stjorna:latest - # git tagging - API_JSON=$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Release of version %s","draft": false,"prerelease": false}' $VERSION $VERSION $VERSION) - curl --data "$API_JSON" https://api.github.com/repos/secanis/stjorna/releases?access_token=$GITHUB_KEY - fi - # otherwise publish the current branch build - docker push docker.io/secanis/stjorna:dev-${CIRCLE_BRANCH/\//-} + VERSION=$(node -p -e "require('./server/package.json').version") + # pack application + rm -rf server/public; mv ./client/dist ./server/public + cd server && tar -czf ../stjorna-$VERSION.tar.gz * + docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} docker.io + cd ../ && docker build --pull --build-arg VERSION=$VERSION -t docker.io/secanis/stjorna:$VERSION -t docker.io/secanis/stjorna:latest -t docker.io/secanis/stjorna:dev-${CIRCLE_BRANCH/\//-} . + # docker build: if RELEASE then push it + if [ -n "$RELEASE" ]; then + # docker push + docker push docker.io/secanis/stjorna:$VERSION + docker push docker.io/secanis/stjorna:latest + # git tagging + API_JSON=$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Release of version %s","draft": false,"prerelease": false}' $VERSION $VERSION $VERSION) + curl --data "$API_JSON" https://api.github.com/repos/secanis/stjorna/releases?access_token=$GITHUB_KEY + fi + # otherwise publish the current branch build + docker push docker.io/secanis/stjorna:dev-${CIRCLE_BRANCH/\//-} - store_artifacts: path: stjorna-*.tar.gz