garm/.github/workflows/build-and-push.yml
Gabriel Adrian Samfira b41318c948 Allow for nightly builds
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2025-05-20 17:00:59 +00:00

80 lines
2.6 KiB
YAML

name: "Build GARM images"
on:
workflow_dispatch:
inputs:
push_to_project:
description: "Project to build images for"
required: true
default: "ghcr.io/cloudbase"
ref:
description: "Ref to build"
required: true
default: "main"
permissions:
contents: read
jobs:
images:
permissions:
packages: write
name: "Build GARM images"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
path: src/github.com/cloudbase/garm
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
run: |
set -x
cd src/github.com/cloudbase/garm
VERSION=$(git describe --tags --match='v[0-9]*' --always)
AZURE_REF=v0.1.0
OPENSTACK_REF=v0.1.0
LXD_REF=v0.1.0
INCUS_REF=v0.1.0
AWS_REF=v0.1.0
GCP_REF=v0.1.0
EQUINIX_REF=v0.1.0
K8S_REF=v0.3.2
if [ "${{ github.event.inputs.ref }}" == "main" ]; then
AZURE_REF="main"
OPENSTACK_REF="main"
LXD_REF="main"
INCUS_REF="main"
AWS_REF="main"
GCP_REF="main"
EQUINIX_REF="main"
K8S_REF="main"
VERSION="nightly"
fi
docker buildx build \
--provenance=false \
--platform linux/amd64,linux/arm64 \
--label "org.opencontainers.image.source=https://github.com/cloudbase/garm/tree/${{ github.event.inputs.ref }}" \
--label "org.opencontainers.image.description=GARM ${{ github.event.inputs.ref }}" \
--label "org.opencontainers.image.licenses=Apache 2.0" \
--build-arg="GARM_REF=${{ github.event.inputs.ref }}" \
--build-arg="AZURE_REF=${AZURE_REF}" \
--build-arg="OPENSTACK_REF=${OPENSTACK_REF}" \
--build-arg="LXD_REF=${LXD_REF}" \
--build-arg="INCUS_REF=${INCUS_REF}" \
--build-arg="AWS_REF=${AWS_REF}" \
--build-arg="GCP_REF=${GCP_REF}" \
--build-arg="EQUINIX_REF=${EQUINIX_REF}" \
--build-arg="K8S_REF=${K8S_REF}" \
-t ${{ github.event.inputs.push_to_project }}/garm:"${VERSION}" \
--push .