Skip to content

Merge branch 'main' into cli-enhancements #312

Merge branch 'main' into cli-enhancements

Merge branch 'main' into cli-enhancements #312

Workflow file for this run

name: Build and push container image
on:
workflow_dispatch:
push:
merge_group:
env:
PUSH: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
REGISTRY: quay.io
QUAY_ORG: quay.io/jumpstarter-dev
jobs:
build-and-push-image:
strategy:
matrix:
image:
- jumpstarter-dev/jumpstarter Dockerfile
- jumpstarter-dev/jumpstarter-dev .devfile/Containerfile
- jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get image name and container file
run: |
IMAGE="${{ matrix.image }}"
IMAGE_NAME=$(echo $IMAGE | awk '{print $1}')
CONTAINERFILE=$(echo $IMAGE | awk '{print $2}')
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
echo "IMAGE_NAME=${IMAGE_NAME}"
echo "CONTAINERFILE=${CONTAINERFILE}" >> $GITHUB_ENV
echo "CONTAINERFILE=${CONTAINERFILE}"
- name: Get version
run: |
VERSION=$(git describe --tags)
VERSION=${VERSION#v} # remove the leading v prefix for version
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "VERSION=${VERSION}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
if: ${{ env.PUSH == 'true' }}
with:
registry: ${{ env.REGISTRY }}
username: jumpstarter-dev+jumpstarter_ci
password: ${{ secrets.QUAY_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.CONTAINERFILE }}
push: ${{ env.PUSH }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
if: ${{ env.PUSH == 'true' }}
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: ${{ env.PUSH }}