init
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
name: Docker Build and Push
|
||||
description: Build, test, tag, and optionally push the Hamkar image
|
||||
inputs:
|
||||
image:
|
||||
description: Full OCI image name without a tag
|
||||
required: true
|
||||
branch:
|
||||
description: Human-readable image tag
|
||||
required: true
|
||||
commit_sha:
|
||||
description: Immutable commit image tag
|
||||
required: true
|
||||
push:
|
||||
description: Push both tags to the registry
|
||||
required: false
|
||||
default: "true"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Build image
|
||||
shell: bash
|
||||
env:
|
||||
IMAGE: ${{ inputs.image }}
|
||||
BRANCH: ${{ inputs.branch }}
|
||||
COMMIT_SHA: ${{ inputs.commit_sha }}
|
||||
PUSH_IMAGE: ${{ inputs.push }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
go_proxy="${GOPROXY:-https://proxy.golang.org/}"
|
||||
output=(--load)
|
||||
if [[ "$PUSH_IMAGE" == "true" ]]; then
|
||||
output=(--push)
|
||||
fi
|
||||
|
||||
docker buildx build \
|
||||
-f Dockerfile \
|
||||
--build-arg "GO_PROXY=$go_proxy" \
|
||||
--label "org.opencontainers.image.revision=$COMMIT_SHA" \
|
||||
--label "org.opencontainers.image.source=${GITHUB_SERVER_URL:-}" \
|
||||
"${output[@]}" \
|
||||
-t "$IMAGE:$BRANCH" \
|
||||
-t "$IMAGE:$COMMIT_SHA" \
|
||||
.
|
||||
Reference in New Issue
Block a user