1
1
version : 2.1
2
2
jobs :
3
3
build :
4
- resource_class : xlarge
5
4
docker :
6
5
# image with node, npm and yarn installed
7
- - image : cimg/node:16.8.0
6
+ - image : cimg/node:18.16.1
7
+ auth :
8
+ username : $DOCKER_HUB_USERNAME
9
+ password : $DOCKER_HUB_PASSWORD
10
+ resource_class : xlarge
8
11
steps :
9
12
# checkout workspace to repo code
10
13
- checkout
42
45
paths :
43
46
- build
44
47
45
- deploy :
48
+ deploy-gcp :
49
+ docker :
50
+ - image : cimg/gcp:2023.08
51
+ auth :
52
+ username : $DOCKER_HUB_USERNAME
53
+ password : $DOCKER_HUB_PASSWORD
54
+ steps :
55
+ - attach_workspace :
56
+ at : .
57
+
58
+ - run :
59
+ name : activate GCP service account
60
+ command : |
61
+ echo $GCP_SERVICE_KEY > ${HOME}/gcloud-service-key.json
62
+ gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
63
+ gcloud config set project $GCP_PROJECT_ID
64
+
65
+ - run :
66
+ name : deploy to gcp
67
+ command : |
68
+ gcloud storage cp -R build/* gs://zilswap-webapp-${CIRCLE_BRANCH}/
69
+
70
+ deploy-ipfs :
46
71
docker :
47
72
- image : cimg/node:16.8.0
48
73
steps :
57
82
name : install ipfs-deploy
58
83
command : NPM_CONFIG_PREFIX=~/.npm-global npm install -g ipfs-deploy
59
84
60
- - run :
61
- name : install AWS CLI
62
- command : |
63
- sudo apt-get --allow-releaseinfo-change update
64
- sudo apt-get install awscli
65
-
66
85
- save_cache :
67
86
paths :
68
87
- ~/.npm-global
@@ -81,31 +100,6 @@ jobs:
81
100
~/.npm-global/bin/ipfs-deploy build/ -d cloudflare -C
82
101
fi
83
102
84
- - run :
85
- name : deploy to aws
86
- command : |
87
- if [ -d "build/static/js" ]
88
- then
89
- gzip -9 build/static/js/*
90
- for i in ./build/static/js/*;
91
- do mv "$i" "${i%.gz}";
92
- done
93
- fi
94
-
95
- if [ "${CIRCLE_BRANCH}" = "staging" ]; then
96
- aws s3 sync build s3://zilswap-ui-staging/ --delete --exclude "static/js/*"
97
- aws s3 sync build/static/js s3://zilswap-ui-staging/static/js --delete --content-encoding gzip
98
- aws cloudfront create-invalidation --distribution-id="E4QZBREBNL47S" --paths=/*
99
- elif [ "${CIRCLE_BRANCH}" = "master" ]; then
100
- aws s3 sync build s3://zilswap-ui/production/ --delete --exclude "static/js/*"
101
- aws s3 sync build/static/js s3://zilswap-ui/production/static/js --delete --content-encoding gzip
102
- aws cloudfront create-invalidation --distribution-id="ESU80N8RF88HZ" --paths=/*
103
- elif [ "${CIRCLE_BRANCH}" = "develop" ]; then
104
- aws s3 sync build s3://zilswap-ui/develop/ --delete --exclude "static/js/*"
105
- aws s3 sync build/static/js s3://zilswap-ui/develop/static/js --delete --content-encoding gzip
106
- aws cloudfront create-invalidation --distribution-id="E2E0YSY2VDFHFV" --paths=/*
107
- fi
108
-
109
103
workflows :
110
104
build-and-deploy :
111
105
jobs :
@@ -116,8 +110,11 @@ workflows:
116
110
only :
117
111
- master
118
112
- staging
119
- - develop
120
- - deploy :
113
+ - deploy-gcp :
114
+ context : org-switcheo
115
+ requires :
116
+ - build
117
+ - deploy-ipfs :
121
118
context : org-switcheo
122
119
requires :
123
120
- build
0 commit comments