Deploy to ecs by ecspresso #2
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
on: | |
push: | |
branches: | |
- kaigionrails | |
- "kaigionrails*" # e.g. kaigionrails2023, kaigionrails2024 | |
- deploy-kor # for test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: "${{ github.repository == 'kaigionrails/sponsor-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 }}/sponsor-app" | |
tags: | | |
type=sha,format=long,prefix= | |
type=raw,value=latest | |
- uses: docker/build-push-action@v5 | |
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 | |
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::861452569181:role/SponsorAppDeployer" | |
- 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: 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 |