Skip to content

Commit 5788286

Browse files
committed
Update CI script
1 parent 4b2bc84 commit 5788286

File tree

2 files changed

+35
-38
lines changed

2 files changed

+35
-38
lines changed

.circleci/config.yml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
version: 2.1
22
jobs:
33
build:
4-
resource_class: xlarge
54
docker:
65
# 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
811
steps:
912
# checkout workspace to repo code
1013
- checkout
@@ -42,7 +45,29 @@ jobs:
4245
paths:
4346
- build
4447

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:
4671
docker:
4772
- image: cimg/node:16.8.0
4873
steps:
@@ -57,12 +82,6 @@ jobs:
5782
name: install ipfs-deploy
5883
command: NPM_CONFIG_PREFIX=~/.npm-global npm install -g ipfs-deploy
5984

60-
- run:
61-
name: install AWS CLI
62-
command: |
63-
sudo apt-get --allow-releaseinfo-change update
64-
sudo apt-get install awscli
65-
6685
- save_cache:
6786
paths:
6887
- ~/.npm-global
@@ -81,31 +100,6 @@ jobs:
81100
~/.npm-global/bin/ipfs-deploy build/ -d cloudflare -C
82101
fi
83102
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-
109103
workflows:
110104
build-and-deploy:
111105
jobs:
@@ -116,8 +110,11 @@ workflows:
116110
only:
117111
- master
118112
- staging
119-
- develop
120-
- deploy:
113+
- deploy-gcp:
114+
context: org-switcheo
115+
requires:
116+
- build
117+
- deploy-ipfs:
121118
context: org-switcheo
122119
requires:
123120
- build

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
"zilswap-sdk": "^1.3.24"
6262
},
6363
"scripts": {
64-
"start": "react-scripts start",
65-
"build": "react-scripts build",
64+
"start": "react-scripts --openssl-legacy-provider start",
65+
"build": "react-scripts --openssl-legacy-provider build",
6666
"postbuild": "cp build/index.html build/ipfs-404.html",
6767
"test": "react-scripts test",
6868
"eject": "react-scripts eject",

0 commit comments

Comments
 (0)