Skip to content

Commit 52512d5

Browse files
committed
Add staging deployment option
1 parent 3777c51 commit 52512d5

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ jobs:
298298
- docker_cache
299299
deploy-to-production:
300300
executor: node
301+
environment:
302+
ENVIRONMENT: production
301303
steps:
302304
- checkout_with_cache
303305
- restore_cache: *restore_deps_cache
@@ -311,6 +313,17 @@ jobs:
311313
- run:
312314
name: Deploy Sentry release
313315
command: node packages/app/scripts/sentry-deploy-release.js
316+
deploy-to-staging:
317+
executor: node
318+
environment:
319+
ENVIRONMENT: staging
320+
steps:
321+
- checkout_with_cache
322+
- restore_cache: *restore_deps_cache
323+
- attach_workspace: *attach_deps_workspace
324+
- run:
325+
name: Deploy Image
326+
command: node packages/app/scripts/deploy.js
314327

315328
################################
316329
# Workflows
@@ -347,6 +360,16 @@ workflows:
347360
type: approval
348361
requires:
349362
- create-docker-image
363+
branches:
364+
only:
365+
- master
350366
- deploy-to-production:
351367
requires:
352368
- deploy-production-approval
369+
- deploy-staging-approval:
370+
type: approval
371+
requires:
372+
- create-docker-image
373+
- deploy-to-staging:
374+
requires:
375+
- deploy-staging-approval

packages/app/scripts/deploy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fetch('https://deployment-api.lbogdan.ro/image', {
77
Authorization: `Bearer ${process.env.DEPLOY_TOKEN}`,
88
},
99
body: JSON.stringify({
10-
env: 'production',
10+
env: process.env.ENVIRONMENT,
1111
image: 'client',
1212
tag: process.env.CIRCLE_SHA1.substr(0, 7),
1313
deploy: true,

0 commit comments

Comments
 (0)