-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (46 loc) · 1.57 KB
/
krm-release-scripts-ci.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: KRM Release scripts Docker Image CI
on:
push:
branches:
- master
paths:
- 'scripts/**'
jobs:
build:
name: docker
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
# Generating the Docker Image Tag
- name: Docker Image Tag creation
id: image_tag
shell: bash
run: |
GCR_PROJECT_ID="${{ secrets.BEECASH_PROJECT_ID }}"
IMAGE="gcr.io/$GCR_PROJECT_ID/infra/krm-functions/krm-release"
BRANCH="${GITHUB_REF#refs/heads/}"
SHA="$(git rev-parse --short HEAD)"
JOB_ID="${GITHUB_RUN_NUMBER}"
IMAGE_TAG="$BRANCH-cijob-$JOB_ID-commit-$SHA"
echo "IMAGE=$IMAGE" >> $GITHUB_OUTPUT
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo ":whale2: Image Tag: ${IMAGE_TAG} " >> $GITHUB_STEP_SUMMARY
# Login to GCR
- name: docker login
uses: "lagren/docker-gcr-action@master"
with:
SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_CLOUD_ACCOUNT }}
HOST: "gcr.io"
# Build and push to GCR
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: docker publish image
uses: docker/[email protected]
with:
context: ./scripts
file: ./scripts/Dockerfile
push: true
tags: ${{ steps.image_tag.outputs.IMAGE }}:${{ steps.image_tag.outputs.IMAGE_TAG }}, ${{ steps.image_tag.outputs.IMAGE }}:latest
cache-from: type=gha,mode=max
cache-to: type=gha,mode=max