Compare commits

...

4 commits

Author SHA1 Message Date
Michael Hogg
0a9d6b2226
Include git metadata in docker build context (#7393)
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions
cmake/getversion.cmake reads the commit date and release tag from git, but .dockerignore excluded .git/, so docker builds had no git info and Servatrice reported its version as "3.1.0 ()". Keep .git/ in the build context; only /usr/local is copied into the final image, so its size is unaffected.

Co-authored-by: Michael Hogg <3495076+jedinerd@users.noreply.github.com>
2026-10-04 03:48:15 +02:00
Michael Hogg
885b50de00
Allow manually publishing a release image in docker workflow (#7392)
Add a workflow_dispatch trigger that builds an existing release tag with the current workflow and publishes it to GHCR under that tag name (optionally also as latest). This allows republishing a release whose image failed to publish, since re-running the original run reuses the workflow file from the release tag.

Dispatched runs check out the given tag, publish like stable releases, and use their own concurrency group so pushes to master can't cancel them.

Co-authored-by: Michael Hogg <3495076+jedinerd@users.noreply.github.com>
2026-10-04 02:44:54 +02:00
Michael Hogg
76bcc4842b
Fix digest artifact names in docker release workflow (#7391)
With archive: false, actions/upload-artifact ignores the name input and names the artifact after the uploaded file, so the digest artifacts were named after the raw digest instead of digest-<label>. The index job's download-artifact pattern digest-* then matched nothing, leaving no digests to build the image index from. Drop archive: false so the digest-<label> names apply.

Co-authored-by: Michael Hogg <3495076+jedinerd@users.noreply.github.com>
2026-10-04 02:35:24 +02:00
Michael Hogg
b858d684cb
Fix docker metadata tags input in release workflow (#7390)
The inline comment after type=ref,event=tag was inside the tags block scalar, so it was passed to docker/metadata-action as part of the tag spec, failing with "Invalid event". Move the comment above the block.

Co-authored-by: Michael Hogg <3495076+jedinerd@users.noreply.github.com>
2026-10-04 02:35:06 +02:00
2 changed files with 24 additions and 10 deletions

View file

@ -1,4 +1,3 @@
.git/
build/
.github/
.tx/

View file

@ -20,11 +20,22 @@ on:
release:
types:
- released # publishing of stable releases
workflow_dispatch: # (re)publish the image for an existing stable release
inputs:
tag:
description: 'Existing release tag to build and publish (e.g. 2026-10-03-Release-3.1.0)'
required: true
type: string
latest:
description: 'Also update the "latest" tag'
required: true
type: boolean
default: true
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on release)
# Cancel earlier, unfinished runs of this workflow on the same branch (unless publishing)
concurrency:
group: "${{ github.workflow }} @ ${{ github.ref_name }}"
cancel-in-progress: ${{ github.event_name != 'release' }}
group: "${{ github.workflow }} @ ${{ inputs.tag || github.ref_name }}"
cancel-in-progress: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }}
env:
GHCR_IMAGE: ghcr.io/cockatrice/servatrice
@ -57,12 +68,14 @@ jobs:
steps:
- name: "Checkout"
uses: actions/checkout@v7
with:
ref: ${{ case(github.event_name == 'workflow_dispatch', format('refs/tags/{0}', inputs.tag), '') }}
- name: "Set up Docker buildx"
uses: docker/setup-buildx-action@v4
- name: "Login to GitHub Container Registry (GHCR)"
if: github.event_name == 'release' && github.event.release.prerelease == false
if: (github.event_name == 'release' && github.event.release.prerelease == false) || github.event_name == 'workflow_dispatch'
id: login
uses: docker/login-action@v4
with:
@ -70,7 +83,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ github.token }}
# Don't push for non-release triggers
# Don't push for non-publishing triggers
- name: "Build image"
if: steps.login.outcome != 'success'
uses: docker/build-push-action@v7
@ -111,7 +124,6 @@ jobs:
if: steps.login.outcome == 'success'
uses: actions/upload-artifact@v7
with:
archive: false
if-no-files-found: error
name: digest-${{ matrix.label }}
path: ${{ runner.temp }}/digests/*
@ -121,7 +133,7 @@ jobs:
# Create an OCI image index from the platform-specific image manifests
index:
name: "Publish multi-platform Servatrice image"
if: github.repository_owner == 'Cockatrice' && github.event_name == 'release' && github.event.release.prerelease == false
if: github.repository_owner == 'Cockatrice' && ((github.event_name == 'release' && github.event.release.prerelease == false) || github.event_name == 'workflow_dispatch')
needs: build
runs-on: ubuntu-slim # https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md
@ -147,8 +159,11 @@ jobs:
images: ${{ env.GHCR_IMAGE }}
flavor: |
latest=auto
# if semver, also: type=semver,pattern={{version}} / {{major}}.{{minor}}
tags: |
type=ref,event=tag # if semver, also: type=semver,pattern={{version}} / {{major}}.{{minor}}
type=ref,event=tag
type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && inputs.latest }}
# Add OCI annotations to image index and publish tags
- name: "Create image index"
@ -176,7 +191,7 @@ jobs:
- name: "Inspect images"
env:
GITHUB_TAG: ${{ github.ref_name }}
GITHUB_TAG: ${{ inputs.tag || github.ref_name }}
run: |
docker buildx imagetools inspect "$GHCR_IMAGE:latest"
docker buildx imagetools inspect "$GHCR_IMAGE:$GITHUB_TAG"