Merge pull request #488 from canopas/feat-migrate-to-nuxt-js #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DeployFrontendProd | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
deploy-frontend-prod: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: "20" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-frontend-access | |
aws-region: ap-south-1 | |
- name: Build frontend and push on ECR | |
run: | | |
cd nuxt-frontend | |
sed -i "s|VITE_IFRAMELY_KEY_VALUE|${{ secrets.IFRAMELY_KEY }}|g" config.prod.js | |
sed -i "s|VITE_RECAPTCHA_SITE_KEY_VALUE|${{ secrets.RECAPTCHA_SITE_KEY }}|g" config.prod.js | |
mv config.prod.js config.js | |
sh ./../deploy/generate-sitemap.sh https://canopas.com https://prod-stack-api.canopas.com | |
yarn install --frozen-lockfile && yarn generate | |
aws s3 sync ./.output/public s3://canopas.com --exclude "*.js" | |
aws s3 sync ./.output/public s3://canopas.com --include "*.js" --content-type "application/javascript" | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.PROD_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" |