Skip to content

Workflow file for this run

name: Create and publish a Docker image
on:
push:
branches: ['main']
env:
REGISTRY: ghcr.io
SERVER_IMAGE_NAME: pavelnikolov/zkpauth-server
CLIENT_IMAGE_NAME: pavelnikolov/zkpauth-client
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
platforms: [linux/amd64, linux/arm64/v8]
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for client images
id: meta_client
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.CLIENT_IMAGE_NAME }}
tags: |
type=sha
- name: Extract metadata (tags, labels) for server images
id: meta_server
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.SERVER_IMAGE_NAME }}
tags: |
type=sha
- name: Build and push client image
id: push_client
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
file: client.Dockerfile
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta_client.outputs.tags }}
labels: ${{ steps.meta_client.outputs.labels }}
- name: Build and push server image
id: push_server
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
file: server.Dockerfile
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta_server.outputs.tags }}
labels: ${{ steps.meta_server.outputs.labels }}
- name: Generate client image artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.CLIENT_IMAGE_NAME}}
subject-digest: ${{ steps.push_client.outputs.digest }}
push-to-registry: true
- name: Generate server image artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.SERVER_IMAGE_NAME}}
subject-digest: ${{ steps.push_server.outputs.digest }}
push-to-registry: true