-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (47 loc) · 1.5 KB
/
push-ingestor-build.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
name: Build and push ingestor to remote
on:
push:
branches:
- main
paths:
- "ingestion_tools/**"
- "apiv2/**"
- ".github/workflows/push-ingestor-build.yaml"
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
permissions:
id-token: write
contents: read
jobs:
push-images:
strategy:
matrix:
include:
- build_dir: ingestion_tools
repo_key: ECR_REPO
- build_dir: apiv2
repo_key: ECR_REPO_V2
name: build and push ingestor to remote
runs-on: ubuntu-latest
environment: staging
if: github.repository == 'chanzuckerberg/cryoet-data-portal-backend'
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
mask-aws-account-id: true
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 1200
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Checkout code
uses: actions/checkout@v3
- name: Docker build & Push
uses: docker/build-push-action@v4
with:
context: ./${{ matrix.build_dir }}
file: ./${{ matrix.build_dir }}/Dockerfile
tags: ${{ secrets[matrix.repo_key] }}:${{ github.head_ref || github.ref_name }}
push: true
provenance: false