Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update deployment cicd #128

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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