-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
62 lines (52 loc) · 2.57 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
image: node:10
cache:
paths:
- node_modules/
# Staging environment, using when testing before releasing a new version
# Run only when pushing to branch: master
staging:
stage: build
only:
- master
environment:
name: staging
script:
# Export all variables to .env.production
- echo SHOPIFY_API_KEY=$STAGING_SHOPIFY_API_KEY >> packages/assets/.env.production
- echo FIREBASE_API_KEY=$STAGING_FIREBASE_API_KEY >> packages/assets/.env.production
- echo FIREBASE_AUTH_DOMAIN=$STAGING_FIREBASE_AUTH_DOMAIN >> packages/assets/.env.production
- echo FIREBASE_PROJECT_ID=$STAGING_FIREBASE_PROJECT_ID >> packages/assets/.env.production
- echo FIREBASE_STORAGE_BUCKET=$STAGING_FIREBASE_STORAGE_BUCKET >> packages/assets/.env.production
- echo FIREBASE_APP_ID=$STAGING_FIREBASE_APP_ID >> packages/assets/.env.production
- echo FIREBASE_MEASUREMENT_ID=$STAGING_FIREBASE_MEASUREMENT_ID >> packages/assets/.env.production
- echo GTM_ID=$GTM_ID >> packages/assets/.env.production
- NPM_TOKEN=$NPM_TOKEN
- npm install -g firebase-tools yarn
- yarn install
- yarn workspace @avada/assets run production
- firebase use --token $FIREBASE_DEPLOY_KEY staging
- firebase deploy -m "Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive --token $FIREBASE_DEPLOY_KEY
# Production environment, deploy a new version for application
# Run only when release a new version with a new tag from Gitlab
production:
stage: deploy
environment:
name: production
only:
- tags
script:
# Export all variables to .env.development
- echo SHOPIFY_API_KEY=$PROD_SHOPIFY_API_KEY >> packages/assets/.env.production
- echo FIREBASE_API_KEY=$PROD_FIREBASE_API_KEY >> packages/assets/.env.production
- echo FIREBASE_AUTH_DOMAIN=$PROD_FIREBASE_AUTH_DOMAIN >> packages/assets/.env.production
- echo FIREBASE_PROJECT_ID=$PROD_FIREBASE_PROJECT_ID >> packages/assets/.env.production
- echo FIREBASE_STORAGE_BUCKET=$PROD_FIREBASE_STORAGE_BUCKET >> packages/assets/.env.production
- echo FIREBASE_APP_ID=$PROD_FIREBASE_APP_ID >> packages/assets/.env.production
- echo FIREBASE_MEASUREMENT_ID=$PROD_FIREBASE_MEASUREMENT_ID >> packages/assets/.env.production
- echo GTM_ID=$GTM_ID >> packages/assets/.env.production
- NPM_TOKEN=$NPM_TOKEN
- npm install -g firebase-tools yarn
- yarn install
- yarn workspace @avada/assets run production
- firebase use --token $FIREBASE_DEPLOY_KEY production
- firebase deploy -m "Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive --token $FIREBASE_DEPLOY_KEY