2a9d95d3d9
Publish container / publish (push) Successful in 24s
Bakes the git commit SHA into the image at build time (Dockerfile GIT_SHA/BUILD_DATE build-args, set by the CI workflow) and surfaces it as a small "vX.Y.Z · <sha>" tag on the sign-in screen and in the header user-menu, sourced from the existing unauthenticated /api/health endpoint (now also returns appVersion/buildSha/buildDate). Also adds buildSha/buildDate to the admin diagnostics payload. This makes it possible to tell at a glance whether a running container matches the latest published image without digging through registry timestamps.
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
name: Publish container
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Determine target registry
|
|
id: registry
|
|
run: |
|
|
if [ "${{ github.server_url }}" = "https://github.com" ]; then
|
|
echo "registry=ghcr.io" >> "$GITHUB_OUTPUT"
|
|
echo "image=ghcr.io/mfwadejr/vboxstock" >> "$GITHUB_OUTPUT"
|
|
else
|
|
host="$(printf '%s' '${{ github.server_url }}' | sed -E 's#^https?://##')"
|
|
echo "registry=$host" >> "$GITHUB_OUTPUT"
|
|
echo "image=$host/marvin/vboxstock" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Sign in to container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ steps.registry.outputs.registry }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ github.server_url == 'https://github.com' && secrets.GITHUB_TOKEN || secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Generate image tags
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ steps.registry.outputs.image }}
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=ref,event=tag
|
|
type=sha
|
|
|
|
- name: Build and publish image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
GIT_SHA=${{ github.sha }}
|
|
BUILD_DATE=${{ github.event.repository.updated_at || github.run_id }}
|