blob: 39f1e15ee064607472a0d12f71a19384e73f4889 [file] [log] [blame]
name: build
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
image_push:
type: boolean
description: 'Push images to Container Registry'
required: false
default: false
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches:
- main
jobs:
image:
runs-on: ubuntu-latest
strategy:
matrix:
from:
- jammy
release:
- "2023.1"
steps:
- name: Install QEMU static binaries
uses: docker/setup-qemu-action@v2
- name: Configure Buildkit
uses: docker/setup-buildx-action@v2
- name: Checkout project
uses: actions/checkout@v3
- name: Setup environment variables
run: echo "PROJECT_REF=${{ github.sha }}" >> "$GITHUB_ENV"
- name: Authenticate with Quay.io
uses: docker/login-action@v2
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.image_push == true) }}
with:
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
- name: Build image
uses: docker/build-push-action@v3
with:
build-args: |-
BUILDER_IMAGE=quay.io/vexxhost/openstack-builder-${{ matrix.from }}
RUNTIME_IMAGE=quay.io/vexxhost/openstack-runtime-${{ matrix.from }}
RELEASE=${{ matrix.release }}
PROJECT=staffln
PROJECT_REPO=https://github.com/vexxhost/staffeln
PROJECT_REF=${{ env.PROJECT_REF }}
cache-from: type=gha,scope=${{ matrix.from }}-${{ matrix.release }}
cache-to: type=gha,mode=max,scope=${{ matrix.from }}-${{ matrix.release }}
context: .
platforms: linux/amd64
push: ${{ github.event_name == 'push' || inputs.image_push == true }}
tags: quay.io/vexxhost/staffeln:${{ env.PROJECT_REF }}-${{ matrix.from }}
- name: Promote image
uses: akhilerm/tag-push-action@v2.0.0
if: github.event_name == 'push' && ((matrix.from == 'focal') || (matrix.from == 'jammy' && matrix.release != 'yoga'))
with:
dst: quay.io/vexxhost/staffeln:${{ matrix.release }}
src: quay.io/vexxhost/staffeln:${{ env.PROJECT_REF }}-${{ matrix.from }}