Skip to content

feat(prod): bump CVR connections (#3351) #100

feat(prod): bump CVR connections (#3351)

feat(prod): bump CVR connections (#3351) #100

name: Build and Deploy Sandbox Zero-Cache AWS CF
on:
push:
branches: [sandbox]
# paths:
# - 'packages/zero-cache/**'
env:
# Setting an environment variable with the value of a configuration variable
ECR_IMAGE_ZERO_CACHE: zero-zbugs-sandbox
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU for amd64
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: runner.os == 'Linux'
- name: Set up Docker for amd64
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_DEFAULT_REGION }}
- name: Login to Amazon ECR
run: |
aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
- name: Build and push Docker image
run: |
docker buildx create --use
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64 --build-arg NPM_TOKEN=${{ secrets.NPM_TOKEN }} -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_IMAGE_ZERO_CACHE:latest -f ./prod/zbugs/Dockerfile --push .
- name: Deploy AWS CF sam
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- name: Set up AWS SAM
uses: aws-actions/setup-sam@v2
- name: Build SAM application
run: sam build -t ./prod/templates/sandbox/template.yml
- name: Validate SAM template
run: sam validate -t ./prod/templates/sandbox/template.yml
- name: Sync SAM application
run: sam deploy -t ./prod/templates/sandbox/template.yml --parameter-overrides ZeroUpstreamDB=${{ secrets.SANDBOX_ZERO_UPSTREAM_DB }} ZeroCvrDB=${{ secrets.SANDBOX_ZERO_CVR_DB }} ZeroChangeDb=${{ secrets.SANDBOX_ZERO_CHANGE_DB }} ZeroJwtSecret=${{ secrets.SANDBOX_ZERO_JWT_SECRET }} AwsAccessKeyID=${{ secrets.AWS_ACCESS_KEY_ID }} AwsSecretAccessKey=${{ secrets.AWS_SECRET_ACCESS_KEY }} CertificateArn=${{ vars.SANDBOX_CERTIFICATE_ARN }}
- name: Restart replication-manager
uses: imehedi/actions-awscli-v2@latest
with:
args: ecs update-service --cluster zbugs-sandbox-Cluster-oK3YaqvCWGfA --service replication-manager --force-new-deployment
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
- name: Restart view-syncer
uses: imehedi/actions-awscli-v2@latest
with:
args: ecs update-service --cluster zbugs-sandbox-Cluster-oK3YaqvCWGfA --service view-syncer --force-new-deployment
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}