Skip to content

Instantly share code, notes, and snippets.

@anuraagdjain
Created August 14, 2019 05:46
Show Gist options
  • Save anuraagdjain/56dd08eecb56ab170308d0270d2f3400 to your computer and use it in GitHub Desktop.
Save anuraagdjain/56dd08eecb56ab170308d0270d2f3400 to your computer and use it in GitHub Desktop.
Multi-Environment Gitlab
image: ubuntu:latest
variables:
WORK_DIR: ${CI_PROJECT_NAME}
BRANCH: ${CI_COMMIT_REF_NAME}
stages:
- staging
- production
staging:
stage: staging
environment:
name: 'staging'
script:
- echo "$STAGING_ENV" > .env.staging.tmp
- # decode and rename the file to .env.staging
- # deploy to server
- # restart server
only:
- staging
production:
stage: production
environment:
name: 'production'
script:
- echo "$PROD_ENV" > .env.production.tmp
- # decode and rename the file to .env.production
- # deploy to server
- # restart server
only:
- production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment