Skip to content

Push to prod release #7

Push to prod release

Push to prod release #7

Workflow file for this run

# On merge to production, build a container and deploy to ECR and ECS on `nypl` account
name: Publish to production environment
on:
push:
branches: [production]
permissions:
id-token: write
contents: read
jobs:
publish_qa:
name: Publish image to ECR
# only run if PR is merged (not just closed)
# if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::463786892988:role/GithubActionsDeployerRole
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
REGISTRY_API_DOMAIN: https://libraryregistry.librarysimplified.org/admin
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: nyplsimplye-registry
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
--build-arg REGISTRY_API_DOMAIN=$REGISTRY_API_DOMAIN .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:registry-admin-prod-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:registry-admin-prod-latest
- name: Force ECS Update
run: |
aws ecs update-service --cluster simplye-registry-admin-prod --service simplye-registry-admin-prod --force-new-deployment