Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- image: node:18
- stages:
- - test
- - migrate
- - deploy
- test:
- stage: test
- script:
- - npm ci
- - npm test
- rules:
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /(develop|main)/'
- migration_staging:
- stage: migrate
- script:
- - npx [email protected] db push --db-url "$DATABASE_CONNECTION_STRING_STAGING"
- rules:
- - if: '$CI_COMMIT_REF_NAME == "develop" && $CI_PIPELINE_SOURCE == "push"'
- deploy_staging:
- stage: deploy
- only:
- - develop
- script:
- - npm install --global vercel
- - vercel deploy --yes --token=$VERCEL_TOKEN --scope redacted > deployment-url.txt
- - DEPLOYMENT_URL=$(cat deployment-url.txt)
- - vercel alias --token $VERCEL_TOKEN $DEPLOYMENT_URL staging.redacted.com --scope redacted
- migrate_production:
- stage: migrate
- script:
- - npx [email protected] db push --db-url "$DATABASE_CONNECTION_STRING_PROD"
- rules:
- - if: '$CI_COMMIT_REF_NAME == "main" && $CI_PIPELINE_SOURCE == "push"'
- deploy_production:
- stage: deploy
- only:
- - main
- script:
- - npm install --global vercel
- - vercel deploy --yes --prod --token=$VERCEL_TOKEN
Advertisement
Add Comment
Please, Sign In to add comment