Last active
January 20, 2022 20:02
-
-
Save mmasztalerczuk/33270f28c12a676ab92da0ce32b937ec to your computer and use it in GitHub Desktop.
Example gitlab-ci yaml
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:8.12.0-alpine | |
cache: | |
paths: | |
- node_modules/ | |
variables: | |
AWS_DEFAULT_REGION: us-east-2 | |
BUCKET_NAME: test55555 | |
stages: | |
- build | |
- deploy | |
build: | |
stage: build | |
variables: | |
VUE_APP_ROUTER_BASE: ${CI_COMMIT_REF_SLUG}/${CI_COMMIT_SHA} | |
script: | |
- npm install | |
- npm rebuild node-sass | |
- npm run build | |
artifacts: | |
paths: | |
- dist/ | |
only: | |
- branches | |
except: | |
- master | |
deploy_review: | |
image: python:latest | |
stage: deploy | |
dependencies: | |
- build | |
script: | |
- pip install awscli | |
- aws s3 cp dist s3://${BUCKET_NAME}/${CI_COMMIT_REF_SLUG}/${CI_COMMIT_SHA} --recursive | |
environment: | |
name: review/${CI_COMMIT_REF_SLUG} | |
url: https://${BUCKET_NAME}.s3-website.${AWS_DEFAULT_REGION}.amazonaws.com/${CI_COMMIT_REF_SLUG}/${CI_COMMIT_SHA} | |
on_stop: remove_s3 | |
only: | |
- branches | |
except: | |
- master | |
remove_s3: | |
image: python:latest | |
stage: deploy | |
variables: | |
GIT_STRATEGY: none | |
script: | |
- pip install awscli | |
- aws s3 rm s3://${BUCKET_NAME}/${CI_COMMIT_REF_SLUG} --recursive | |
environment: | |
name: review/${CI_COMMIT_REF_SLUG} | |
action: stop | |
when: manual | |
build_prod: | |
stage: build | |
script: | |
- npm install | |
- npm rebuild node-sass | |
- npm run build | |
artifacts: | |
paths: | |
- dist/ | |
only: | |
- master | |
deploy_production: | |
image: python:latest | |
stage: deploy | |
dependencies: | |
- build_prod | |
script: | |
- pip install awscli | |
- aws s3 cp dist s3://${BUCKET_NAME}/ --recursive | |
environment: | |
name: review/${CI_COMMIT_REF_SLUG} | |
url: https://${BUCKET_NAME}.s3-website.${AWS_DEFAULT_REGION}.amazonaws.com/master | |
only: | |
- master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment