Skip to content

Publish Container Image #107

Publish Container Image

Publish Container Image #107

Workflow file for this run

name: Publish Container Image
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions: {}
jobs:
build-and-push:
permissions:
contents: read
id-token: write
packages: write
attestations: write
runs-on: ubuntu-24.04
steps:
- run: |
t=$(gh api --jq .commit.author.date "${ENDPOINT}")
echo "mod-time=${t}" >> "${GITHUB_OUTPUT}"
id: mod-time
env:
ENDPOINT: /repos/${{ github.repository }}/commits/${{ github.sha }}
GH_TOKEN: ${{ github.token }}
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{commit_date 'YYYYMMDDHHmmss'}},enable={{is_default_branch}}
type=sha
type=ref,event=branch,enable={{is_not_default_branch}}
- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
id: build-and-push
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
MOD_TIME=${{ steps.mod-time.outputs.mod-time }}
REVISION=${{ github.sha }}
- uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.build-and-push.outputs.digest }}
push-to-registry: true
dispatch:
needs:
- build-and-push
permissions:
actions: write
runs-on: ubuntu-24.04
steps:
- name: Dispatch Deploy Workflow
run: |
gh workflow run deploy.yml \
--repo "${REPO}" \
--ref "${REF}"
env:
REPO: ${{ github.repository }}
REF: ${{ github.ref_name }}
GH_TOKEN: ${{ github.token }}