Skip to content

Merge pull request #388 from kaigionrails/dependabot/bundler/aws-sdk-… #175

Merge pull request #388 from kaigionrails/dependabot/bundler/aws-sdk-…

Merge pull request #388 from kaigionrails/dependabot/bundler/aws-sdk-… #175

Workflow file for this run

on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
if: "${{ github.repository == 'kaigionrails/conference-app' }}"
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-skip-session-tagging: false
role-to-assume: "arn:aws:iam::861452569180:role/GhaDockerPushToEcr"
- id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- id: meta
uses: docker/metadata-action@v5
with:
images: "${{ steps.login-ecr.outputs.registry }}/conference-app"
tags: |
type=sha,format=long,prefix=
type=raw,value=latest
- uses: docker/build-push-action@v6
with:
context: "."
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
deploy:
runs-on: ubuntu-latest
concurrency:
group: "deploy"
cancel-in-progress: false
needs: ["build"]
permissions:
id-token: write
contents: read
env:
AWS_REGION: us-west-2
steps:
- run: sudo apt-get update && sudo apt-get install jsonnet
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-skip-session-tagging: false
role-to-assume: "arn:aws:iam::861452569180:role/ConferenceAppDeployer"
- uses: kayac/ecspresso@v2
with:
version: latest
- run: ecspresso run --config deploy/ecspresso.jsonnet --ext-str IMAGE_SHA=${{ github.sha }} --overrides-file deploy/runtask-db-migrate.jsonnet
- run: ecspresso deploy --config deploy/ecspresso.jsonnet --ext-str IMAGE_SHA=${{ github.sha }}
- run: |
SERVICE_ARN=arn:aws:apprunner:us-west-2:861452569180:service/conference-app/37cc4e1e45894229965d668879123b40
until [ $(aws apprunner describe-service --service-arn ${SERVICE_ARN} --output json | jq -r '.Service.Status') = RUNNING ]
do
echo waiting
sleep 5
done
- run: jsonnet deploy/apprunner.jsonnet --ext-str IMAGE_SHA=${{ github.sha }} > deploy/apprunner.json
- run: aws apprunner update-service --cli-input-json file://deploy/apprunner.json