Skip to content

πŸ’š Fix ci

πŸ’š Fix ci #3

Workflow file for this run

name: Push to Artifact Registry
on:
push:
branches:
- "releases/**"
- "main"
tags:
- "*"
workflow_dispatch:
inputs:
build_server:
description: "Build server image"
type: boolean
default: true
build_ui:
description: "Build ui image"
type: boolean
default: true
env:
IMAGE_NAME: "zkvm-registry"
AR_REPO_LOCATION: "europe-west1-docker.pkg.dev"
AR_URL: "hyli-shared-all/hyli"
jobs:
build_and_push:
permissions:
contents: "read"
id-token: "write"
packages: "write"
runs-on: ubuntu-latest
strategy:
matrix:
suffix:
- server
- ui
steps:
- name: Checkout
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
uses: actions/checkout@v2
- name: Set up Docker Buildx
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
uses: docker/setup-buildx-action@v3
- name: Docker meta
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.AR_REPO_LOCATION }}/${{ env.AR_URL }}/${{ env.IMAGE_NAME }}-${{ matrix.suffix }}
ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}-${{ matrix.suffix }}
tags: |
type=sha
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- name: Google Auth
uses: google-github-actions/auth@v2
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
with:
workload_identity_provider: "projects/493106494045/locations/global/workloadIdentityPools/hyli-all-pool/providers/hyli-github-provider"
service_account: "ci-builder-sa@hyli-shared-all.iam.gserviceaccount.com"
- name: Docker Auth (Google Artifact Registry)
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
id: docker-auth
run: |
gcloud auth configure-docker ${{ env.AR_REPO_LOCATION }}
- name: Login to GitHub Container Registry
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
if: |
github.event_name == 'push' ||
(matrix.suffix == 'server' && inputs.build_server) ||
(matrix.suffix == 'ui' && inputs.build_ui)
uses: docker/build-push-action@v6
with:
push: true
context: .
file: Dockerfile.${{ matrix.suffix }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}-${{ matrix.suffix }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}-${{ matrix.suffix }}:buildcache,mode=max