Skip to content

release-base

release-base #35

Workflow file for this run

name: release-base
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch: # used for testing
permissions:
contents: write
packages: write
id-token: write
jobs:
release-base:
runs-on: ubuntu-latest
timeout-minutes: 360
strategy:
fail-fast: true
matrix:
runtime:
- base
- applesilicon
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-tags: true
fetch-depth: 0
- name: Install Cosign
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set runtime variables for matrix
run: |
if [ ${{ matrix.runtime }} == "base" ]; then
echo PLATFORMS="linux/amd64,linux/arm64" >> $GITHUB_ENV
echo FILE="Dockerfile.base" >> $GITHUB_ENV
echo TAG="ghcr.io/sozercan/base:latest" >> $GITHUB_ENV
echo CACHE_FROM="type=gha,scope=base" >> $GITHUB_ENV
echo CACHE_TO="type=gha,scope=base,mode=max" >> $GITHUB_ENV
elif [ ${{ matrix.runtime }} == "applesilicon" ]; then
echo PLATFORMS="linux/arm64" >> $GITHUB_ENV
echo FILE="Dockerfile.base-applesilicon" >> $GITHUB_ENV
echo TAG="ghcr.io/sozercan/applesilicon/base:latest" >> $GITHUB_ENV
echo CACHE_FROM="type=gha,scope=base-applesilicon" >> $GITHUB_ENV
echo CACHE_TO="type=gha,scope=base-applesilicon,mode=max" >> $GITHUB_ENV
fi
- name: Build and push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
id: build-and-push
with:
push: true
sbom: true
provenance: true
tags: ${{ env.TAG }}
cache-from: ${{ env.CACHE_FROM }}
cache-to: ${{ env.CACHE_TO }}
platforms: ${{ env.PLATFORMS }}
file: ${{ env.FILE }}
- name: Sign the images with GitHub OIDC Token
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: cosign sign --yes "ghcr.io/sozercan/base@${DIGEST}"
- name: Verify image signature
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: |
cosign verify ghcr.io/sozercan/base@${DIGEST} \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity https://github.com/sozercan/aikit/.github/workflows/release-base.yaml@refs/heads/main