Skip to content

Merge pull request #497 from canopas/design-android-page-according-to… #22

Merge pull request #497 from canopas/design-android-page-according-to…

Merge pull request #497 from canopas/design-android-page-according-to… #22

name: DeployFrontendProd
on:
repository_dispatch:
types: [deploy-blog-prod]
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 nginx and push on ECR
run: |
cd nginx
sed -i "s|WEBSITE_URL|canopas.com|g" conf.d/default.conf
sed -i "s|API_URL|prod-stack-api.canopas.com|g" conf.d/default.conf
bash ./../deploy/deploy-ecr-image.sh prod-nginx ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_REGION.amazonaws.com/canopas-website-nginx
- name: Build frontend and push on ECR
run: |
cd vue-frontend
echo VITE_RECAPTCHA_SITE_KEY=${{ secrets.RECAPTCHA_SITE_KEY }} >> .env
mv src/config.prod.js src/config.js
sh ./../deploy/generate-sitemap.sh https://canopas.com https://prod-stack-api.canopas.com
bash ./../deploy/deploy-ecr-image.sh prod-frontend ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_REGION.amazonaws.com/canopas-website-frontend
- name: Get latest blog image tag
id: get_blog_image_tag
run: |
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.ap-south-1.amazonaws.com
echo "::set-output name=blogImageTag::$(aws ecr describe-images --repository-name canopas-blog --output text --query 'sort_by(imageDetails,& imagePushedAt)[*].imageTags[*]' | grep -w 'prod' | tr '\t' '\n' | tail -1)"
- name: Deploy cloudformation stack
id: canopas-website-prod-ECS-EC2-stack
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: canopas-website-prod-ECS-EC2-stack
template: infrastructure/frontend.yml
capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM
timeout-in-minutes: "10"
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
EnvName=prod,
ClusterName=canopas-website-prod,
ImageTag=${{ github.sha }}-${{ github.run_attempt }}-prod-frontend,
NginxImageTag=${{ github.sha }}-${{ github.run_attempt }}-prod-nginx,
BlogImageTag=${{steps.get_blog_image_tag.outputs.blogImageTag}}