Skip to content

Workflow file for this run

name: Deploy nurax-dev to AWS Elastic Container Service
on:
workflow_dispatch:
inputs:
hyraxTarget:
description: Hyrax ref to use
required: true
default: main
repository_dispatch:
types: [push]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
AWS_REGION: us-east-2
HYRAX_TARGET: ${{ github.event.inputs.hyraxTarget || github.event.client_payload.ref }}
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::${{ secrets.AwsAccount }}:role/GitHubOIDCRole
aws-region: ${{ env.AWS_REGION }}
- run: echo "Building nurax:dev"
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Save git ref info for runtime display
run: |
cat <<__EOC__ > deploy_info.json
{
"branch": "$(git rev-parse --abbrev-ref HEAD)",
"sha": "$(git rev-parse HEAD)",
"last_deployed": "$(date -Iseconds)"
}
__EOC__
cat deploy_info.json
- name: Build, tag, and push image to Amazon ECR
uses: docker/build-push-action@v4
with:
build-args: |
"HYRAX_TARGET=${{ env.HYRAX_TARGET }}"
"RAILS_ENV=production"
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/nurax:dev
- name: "Force new deployment"
run: aws ecs update-service --cluster nurax --service nurax-dev --force-new-deployment