Last active
November 30, 2019 15:46
-
-
Save nsisodiya/101b1ebb5640ce20eecbe7e5306f7020 to your computer and use it in GitHub Desktop.
.gitlab-ci.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: node:9-alpine | |
stages: | |
- lint_test | |
- build | |
lint_test: | |
stage: lint_test | |
before_script: | |
- echo //registry.npmjs.org/:_authToken=$SYNGENTA_NPM_TOKEN >> ~/.npmrc | |
script: | |
- npm install | |
- npm run eslint | |
- npm run test | |
cache: | |
paths: | |
- node_modules | |
artifacts: | |
paths: | |
- node_modules | |
coverage: /All\sfiles.*?\s+(\d+.\d+)/ | |
variables: | |
DOCKER_ECR_REPO_URL: 610716223528.dkr.ecr.eu-central-1.amazonaws.com | |
build: | |
image: docker:stable | |
stage: build | |
dependencies: | |
- lint_test | |
services: | |
- docker:dind | |
only: | |
- master | |
before_script: | |
- apk add --no-cache curl jq python py-pip | |
- pip install awscli | |
script: | |
- $(aws ecr get-login --no-include-email --region eu-central-1) | |
- export PACKAGE_VERSION=$(/bin/sh ./getVersion.sh) | |
- export FULL_DOCKER_URL=${CI_PROJECT_NAME}:${PACKAGE_VERSION} | |
- echo $FULL_DOCKER_URL | |
- docker build -t $FULL_DOCKER_URL . | |
- docker tag $FULL_DOCKER_URL $DOCKER_ECR_REPO_URL/$FULL_DOCKER_URL | |
- docker push $DOCKER_ECR_REPO_URL/$FULL_DOCKER_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo $(cat package.json | grep version | head -1| awk -F: '{ print $2 }' | sed 's/[\",]//g'| tr -d '[[:space:]]') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment