-
Notifications
You must be signed in to change notification settings - Fork 68
59 lines (41 loc) · 1.42 KB
/
main.yaml
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
name: Build
on: push
jobs:
run_tests:
permissions:
contents: read
runs-on: ubuntu-latest
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
steps:
- uses: actions/checkout@v3
- name: Run tests
run: |
pip install pip --upgrade
pip install pyopenssl --upgrade
pip install -r functions/replace-route/requirements.txt
pip install -r functions/replace-route/tests/test_requirements.txt
python -m pytest
build_and_push_image:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: run_tests
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Set outputs
id: sha
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push lambda image to Amazon ECR
run: |
docker build . -t "${{ secrets.ECR_REGISTRY }}/${{ secrets.ECR_REPOSITORY }}:${{ steps.sha.outputs.short_sha }}"
docker push "${{ secrets.ECR_REGISTRY}}/${{ secrets.ECR_REPOSITORY }}:${{ steps.sha.outputs.short_sha }}"