-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (44 loc) · 1.7 KB
/
backend.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
name: Backend
on:
workflow_call:
inputs:
environment:
type: string
description: environment to deploy to
required: true
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
permissions:
id-token: write
contents: read
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: LINT - backend/
uses: dominikh/staticcheck-action@v1
with:
version: "latest"
working-directory: backend
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get Commit SHA
id: revparse
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get AWS Creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ROLEARN }}
role-duration-seconds: 900
aws-region: us-east-1
- name: Docker - Login
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.ECR_REPO_URL }}
- name: Docker - Build
run: docker buildx build --platform linux/amd64 --tag ${{ secrets.ECR_REPO_URL }}:${{ steps.revparse.outputs.sha_short }} --load ./backend
- name: Docker - Push
run: docker push ${{ secrets.ECR_REPO_URL }}:${{ steps.revparse.outputs.sha_short }}
- name: Update Parameter
run: aws ssm put-parameter --name ${{ secrets.PARAMETER_NAME }} --value ${{ steps.revparse.outputs.sha_short }} --overwrite
# Deployment of the latest image will happen with terraform during infrastructure deploy