-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.yaml
42 lines (37 loc) · 1.27 KB
/
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
on:
workflow_call:
inputs:
sha-tag:
description: "A short-form SHA tag for the commit that triggered this flow"
required: true
type: string
lower-repo:
description: "The repository name in lowercase"
required: true
type: string
jobs:
build:
name: Build & Push
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
# Build and push the container to the GitHub Container
# Repository. The container will be tagged as "latest"
# and with the short SHA of the commit.
- name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.ref == github.event.repository.default_branch }}
cache-from: type=registry,ref=ghcr.io/${{ inputs.lower-repo }}:latest
cache-to: type=inline
tags: |
ghcr.io/${{ inputs.lower-repo }}:latest
ghcr.io/${{ inputs.lower-repo }}:${{ inputs.sha-tag }}
build-args: git_sha=${{ github.sha }}