Remove resources from blogs url #538
Workflow file for this run
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: DeployDev | |
on: | |
repository_dispatch: | |
types: [deploy-blog-dev] | |
push: | |
jobs: | |
deploy-dev: | |
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: "18" | |
- 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|dev-stack.canopas.com|g" conf.d/default.conf | |
sed -i "s|API_URL|dev-stack-api.canopas.com|g" conf.d/default.conf | |
bash ./../deploy/deploy-ecr-image.sh dev-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 | |
sh ./../deploy/generate-sitemap.sh https://dev-stack.canopas.com https://dev-stack-api.canopas.com | |
bash ./../deploy/deploy-ecr-image.sh dev-frontend ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_REGION.amazonaws.com/canopas-website-frontend | |
- name: Checkout | |
uses: actions/[email protected] | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: "^1.17.5" | |
- name: Build backend and push on ECR | |
run: | | |
bash ./deploy/deploy-ecr-image.sh dev-backend ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_REGION.amazonaws.com/canopas-website-backend | |
- 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 'dev' | tr '\t' '\n' | tail -1)" | |
- name: Deploy cloudformation stack | |
id: canopas-website-dev-ECS-EC2-stack | |
uses: aws-actions/aws-cloudformation-github-deploy@v1 | |
with: | |
name: canopas-website-dev-ECS-EC2-stack | |
template: infrastructure/template.yml | |
capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM | |
timeout-in-minutes: "10" | |
no-fail-on-empty-changeset: "1" | |
parameter-overrides: >- | |
EnvName=dev, | |
Sender=${{ secrets.SENDER }}, | |
ContactSender=${{ secrets.CONTACT_SENDER }}, | |
JobsReceiver=${{ secrets.JOBS_RECEIVER }}, | |
ContactReceiver=${{ secrets.CONTACT_RECEIVER }}, | |
AccessKeyId=${{ secrets.ACCESS_KEY_ID }}, | |
SecretAccessKey=${{ secrets.SECRET_ACCESS_KEY }}, | |
Region=${{ secrets.AWS_REGION }}, | |
DbUsername=${{ secrets.DB_USERNAME }}, | |
DbPassword=${{ secrets.DB_PASSWORD }}, | |
DbHost=${{ secrets.DB_HOST }}, | |
DbPort=${{ secrets.DB_PORT }}, | |
DbName=${{ secrets.DB_NAME }}, | |
RecaptchaConfigJSONBase64=${{ secrets.RECAPTCHA_CONFIG_JSON_BASE64 }}, | |
RecaptchaSiteKey=${{ secrets.RECAPTCHA_SITE_KEY }}, | |
RecaptchaProjectId=${{ secrets.RECAPTCHA_PROJECT_ID }}, | |
JobsSpreadsheetId=${{ secrets.JOBS_SPREADSHEET_ID }}, | |
JobsSheetId=${{ secrets.JOBS_SHEET_ID }}, | |
GithubAccessToken=${{ secrets.PERSONAL_ACCESS_TOKEN_GITHUB }}, | |
ResourcesURL=${{secrets.RESOURCES_URL}}, | |
ClusterName=canopas-website-dev, | |
ImageTag=${{ github.sha }}-${{ github.run_attempt }}-dev-frontend, | |
BackendImageTag=${{ github.sha }}-${{ github.run_attempt }}-dev-backend, | |
NginxImageTag=${{ github.sha }}-${{ github.run_attempt }}-dev-nginx, | |
BlogImageTag=${{steps.get_blog_image_tag.outputs.blogImageTag}} |