Authorization Webhook #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Docker Image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-and-push: | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
runs-on: ubuntu-latest | |
# Define the services that should be built. | |
strategy: | |
matrix: | |
service: | |
- datum-authorization-webhook | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ghcr.io/datum-cloud/${{ matrix.service }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Build ${{ matrix.service }} | |
id: push | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: cmd/${{ matrix.service }}/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ghcr.io/datum-cloud/${{ matrix.service }} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |