-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 999 Bytes
/
ingest-docker-build.yaml
File metadata and controls
42 lines (34 loc) · 999 Bytes
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
name: Build Docker image for ingestion jobs and push to GCR
on:
push:
branches:
- '*'
paths:
- 'ingest/**'
workflow_dispatch:
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
IMAGE: eoapi-risk-ingest
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Google Container Registry
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Shorten git SHA
id: shorten_sha
run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ingest
push: true
tags: gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE }}:${{ github.ref_name == 'main' && 'latest' || env.SHORT_SHA }}