Skip to content

Commit

Permalink
chore: fixed production deployment script to handle versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
syam babu committed Oct 18, 2024
1 parent 138e125 commit 4dd07da
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/build-production-deploy-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ jobs:
- uses: actions/checkout@v2
- run: npm install
- run: npm run build:production
- run: aws s3 sync ./build s3://${{env.WEBHOSTING_BUCKET_NAME}}/ --acl public-read --delete --cache-control max-age=3600
- run: |
current_version=$(node -p "require('./package.json').version")
major_version=$(echo $current_version | cut -d. -f1)
aws s3 sync ./build s3://${{env.WEBHOSTING_BUCKET_NAME}}/v${major_version}/ --acl public-read --cache-control max-age=3600
previous_major_version=$((major_version - 2))
if [ "$previous_major_version" -ge 0 ]; then
aws s3 rm s3://${{env.WEBHOSTING_BUCKET_NAME}}/v${previous_major_version}/ --recursive || true
fi

0 comments on commit 4dd07da

Please sign in to comment.