.gitlab-ci.yml 1.12 KB
Newer Older
Anush's avatar
Anush committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
# Docker Image location on hub.docker.com, its normally your-username/repo-name
image: anushbmx/react-js-ssr-docker
# pipeline will use this image unless specifed in the stage definition

# Define the stages
stages:
  - test
  - build
  - staging
  - production

# Define the process for each stage
test:
  stage: test
  script:
  - npm install
  - npm test

build:
  stage: build
  script:
    - npm install
    - npm run build
    - ls -la build
    - zip build.zip -r ./build
  artifacts:
    paths:
    - build.zip

deploy_staging:
  image: anushbmx/aws-docker
  stage: staging
  script:
    - unzip build.zip
    - cd build
    - ls -la
    - aws s3 cp ./ s3://$AWS_BUCKET_STAGING --recursive
  environment:
    name: staging
    url: $AWS_STAGING_URL
  only:
  - master
  # this stage will only be executed for master branch

deploy_production:
  image: anushbmx/aws-docker
  stage: production
  when: manual
  # stage needs manual triger to start.
  script:
    - unzip build.zip
    - cd build
    - aws s3 cp ./ s3://$AWS_BUCKET_PRODUCTION --recursive
  environment:
    name: production
    url: $AWS_PRODUCTION_URL
  only:
  - master