ekantin

gitlab-ci.yaml

Aug 9th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. variables:
  2.   S3_BUCKET_PRODUCTION: 'dashboard.kotakmakan.id'
  3.   S3_BUCKET_STAGING: 'staging.dashboard.kotakmakan.id'
  4.   S3_BUCKET_DEVELOPMENT: 'dev.dashboard.kotakmakan.id'
  5.   # CLOUDFRONT_DISTRIBUTION_ID: [FILL THIS YOURSELF]
  6.  
  7. deploy master:
  8.   stage: build
  9.   image: nikolaik/python-nodejs:python3.7-nodejs10
  10.   script:
  11.     - npm install
  12.     - npm run build
  13.     - pip install awscli
  14.     - aws s3 sync dist/ s3://c --recursive --include "*"
  15.     # - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
  16.     - echo "Deploy to http://dashboard.kotakmakan.id.s3-website-ap-southeast-1.amazonaws.com"
  17.   artifacts:
  18.     paths:
  19.       - dist/
  20.   environment:
  21.     name: production
  22.     url: http://dashboard.kotakmakan.id.s3-website-ap-southeast-1.amazonaws.com
  23.   only:
  24.     - master
  25.  
  26. deploy staging:
  27.   stage: build
  28.   image: nikolaik/python-nodejs:python3.7-nodejs10
  29.   script:
  30.     - npm install
  31.     - npm run build
  32.     - pip install awscli
  33.     - aws s3 sync dist/ s3://staging.dashboard.kotakmakan.id --recursive --include "*"
  34.     - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
  35.     - echo "Deploy to http://staging.dashboard.kotakmakan.id.s3-website-ap-southeast-1.amazonaws.com"
  36.   artifacts:
  37.     paths:
  38.       - dist/
  39.   environment:
  40.     name: staging
  41.     url: http://staging.dashboard.kotakmakan.id.s3-website-ap-southeast-1.amazonaws.com
  42.   only:
  43.     - staging
  44.  
  45. deploy development:
  46.   stage: deploy
  47.   image: nikolaik/python-nodejs:python3.7-nodejs10
  48.   script:
  49.     - npm install --progress=false
  50.     - npm run build
  51.     - pip install awscli
  52.     - aws s3 sync --delete --exclude ".git/*" --exclude ".gitignore" --exclude ".gitlab-ci.yml" --exclude ".env*" dist/ s3://dev.dashboard.kotakmakan.id --acl public-read
  53.     - echo "Deploy to http://dev.dashboard.kotakmakan.id.s3-website-ap-southeast-1.amazonaws.com"
  54.   artifacts:
  55.     paths:
  56.       - dist/
  57.   environment:
  58.     name: dev
  59.     url: http://dev.dashboard.kotakmakan.id.s3-website-ap-southeast-1.amazonaws.com
  60.   only:
  61.     - development
Advertisement
Add Comment
Please, Sign In to add comment