Skip to content

Commit

Permalink
feat: update deployment cicd (#128)
Browse files Browse the repository at this point in the history
* feat: update deployment cicd

- add multiple handle for invalid cdn
- update UI s3 destination
  • Loading branch information
stanleyyconsensys authored Aug 31, 2023
1 parent 0de0351 commit b2647d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,19 @@ jobs:
- name: Deploy to Dev
run: |
aws s3 sync ./packages/wallet-ui/build s3://app-dev.starknet-snap.consensys-solutions.net/starknet
aws s3 sync ./packages/wallet-ui/build s3://dev.snaps.consensys.net/starknet
aws s3 sync ./packages/wallet-ui/build s3://dev.snaps.consensys.io/starknet
- name: invalid aws cloudfront cache
env:
AWS_CLOUDFRONT_DISTRIBUTIONS_ID: ${{ vars.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}
run: |
echo "Distribution ID : $AWS_CLOUDFRONT_DISTRIBUTIONS_ID"
id="$(aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTIONS_ID --paths "/index.html" | grep Id | awk -F'"' '{ print $4}')"
echo "Waiting for invalidation $id"
aws cloudfront wait invalidation-completed --id $id --distribution-id $AWS_CLOUDFRONT_DISTRIBUTIONS_ID
echo "Invalidation $id completed"
for process in $(echo $AWS_CLOUDFRONT_DISTRIBUTIONS_ID | sed "s/,/ /g")
do
echo "Processing Distribution ID : $process"
id="$(aws cloudfront create-invalidation --distribution-id $process --paths "/starknet/*" | grep Id | awk -F'"' '{ print $4}')"
echo "Waiting for invalidation $id"
aws cloudfront wait invalidation-completed --id $id --distribution-id $process
echo "Invalidation $id completed"
done
15 changes: 10 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
yarn workspace @consensys/starknet-snap build
npm publish ./packages/starknet-snap --tag staging --access public 2>&1 > /dev/null || :
aws s3 sync ./packages/wallet-ui/build s3://app-staging.starknet-snap.consensys-solutions.net/starknet
aws s3 sync ./packages/wallet-ui/build s3://staging.snaps.consensys.net/starknet
aws s3 sync ./packages/wallet-ui/build s3://staging.snaps.consensys.io/starknet
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: inputs.environment == 'staging'
Expand All @@ -67,6 +67,7 @@ jobs:
npm publish ./packages/starknet-snap --tag latest --access public 2>&1 > /dev/null || :
aws s3 sync ./packages/wallet-ui/build s3://snaps.consensys.net/starknet
aws s3 sync ./packages/wallet-ui/build s3://snaps.consensys.io/starknet
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: inputs.environment == 'production'
Expand All @@ -76,7 +77,11 @@ jobs:
AWS_CLOUDFRONT_DISTRIBUTIONS_ID: ${{ vars.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}
run: |
echo "Distribution ID : $AWS_CLOUDFRONT_DISTRIBUTIONS_ID"
id="$(aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTIONS_ID --paths "/starknet/*" | grep Id | awk -F'"' '{ print $4}')"
echo "Waiting for invalidation $id"
aws cloudfront wait invalidation-completed --id $id --distribution-id $AWS_CLOUDFRONT_DISTRIBUTIONS_ID
echo "Invalidation $id completed"
for process in $(echo $AWS_CLOUDFRONT_DISTRIBUTIONS_ID | sed "s/,/ /g")
do
echo "Processing Distribution ID : $process"
id="$(aws cloudfront create-invalidation --distribution-id $process --paths "/starknet/*" | grep Id | awk -F'"' '{ print $4}')"
echo "Waiting for invalidation $id"
aws cloudfront wait invalidation-completed --id $id --distribution-id $process
echo "Invalidation $id completed"
done

0 comments on commit b2647d0

Please sign in to comment.