-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.25 KB
/
build-image.yml
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
name: Build Image and Publish to GCR
on:
workflow_call:
inputs:
branch:
type: string
required: true
checked-out-sha:
type: string
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.environment }}
cancel-in-progress: true
env:
DOCKER_IMAGE: sts-content-and-support
GITHUB_CONTAINER_REGISTRY: ghcr.io
ORG_NAME: dfe-digital
jobs:
build-image:
runs-on: ubuntu-latest
name: Build & Publish Image
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: GitHub Container Registry Login
uses: docker/login-action@v3
with:
registry: ${{ env.GITHUB_CONTAINER_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Image & Publish To GCR
uses: docker/build-push-action@v5
with:
context: ./
file: ./.dockerfile
build-args: COMMIT_SHA=${{ inputs.checked-out-sha }}
tags: |
${{ env.GITHUB_CONTAINER_REGISTRY }}/${{ env.ORG_NAME }}/${{ env.DOCKER_IMAGE }}:${{ inputs.branch }}-${{ inputs.checked-out-sha }}
push: true