-
Notifications
You must be signed in to change notification settings - Fork 22
70 lines (69 loc) · 2.44 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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