-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (36 loc) · 1.11 KB
/
Copy pathbuild.yaml
File metadata and controls
41 lines (36 loc) · 1.11 KB
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 and push to GCR
on:
push:
branches:
- '**'
jobs:
build:
name: Build image
runs-on: ubuntu-latest
env:
HASH: $(git rev-parse --short "$GITHUB_SHA")
BRANCH: ${GITHUB_REF##*/}
SERVICE_NAME: acceptance-sentinel
PROJECT_ID: ${{ secrets.PROJECT_ID }}
steps:
- name: Checkout
uses: actions/checkout@v2
- id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }}
- name: Build Image
run: |-
IMAGE_NAME=eu.gcr.io/$PROJECT_ID/$SERVICE_NAME
docker build -t $IMAGE_NAME:$GITHUB_SHA .
docker tag $IMAGE_NAME:$GITHUB_SHA $IMAGE_NAME:latest
# Configure docker to use the gcloud command-line tool as a credential helper
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Configure registry
run: |
gcloud auth configure-docker -q
# Push image to Google Container Registry
- name: Push
run: |-
docker push eu.gcr.io/$PROJECT_ID/$SERVICE_NAME --all-tags