chore(release): v2.2.7

This commit is contained in:
matt 2025-09-10 08:01:51 -07:00
parent 6fe8a7af89
commit 45658d0b72
6 changed files with 247 additions and 87 deletions

View file

@ -7,11 +7,16 @@ on:
workflow_dispatch:
jobs:
docker:
prepare:
name: Prepare metadata
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.notes.outputs.version }}
desc: ${{ steps.notes.outputs.desc }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
@ -29,43 +34,10 @@ jobs:
echo >> RELEASE_NOTES.md
echo "Automated release." >> RELEASE_NOTES.md
fi
# Escape newlines for label usage
DESC=$(awk 'BEGIN{ORS="\\n"} {print}' RELEASE_NOTES.md)
echo "desc=$DESC" >> $GITHUB_OUTPUT
echo "version=$VERSION_REF" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.11.1
- name: Smoke test image boots Web UI by default (amd64)
shell: bash
run: |
# Build a local test image (amd64) and load into docker
docker buildx build --platform linux/amd64 --load -t mtg-deckbuilder:test --build-arg APP_VERSION=${{ steps.notes.outputs.version }} .
# Run container and wait for it to serve on 8080
docker rm -f mtg-smoke 2>/dev/null || true
docker run -d --name mtg-smoke -p 8080:8080 mtg-deckbuilder:test
echo "Waiting for Web UI..."
for i in {1..30}; do
if curl -fsS http://localhost:8080/ >/dev/null; then echo "Up"; break; fi
sleep 2
done
# Final assert; print logs on failure
if ! curl -fsS http://localhost:8080/ >/dev/null; then
echo "Web UI did not start in time. Container logs:" && docker logs mtg-smoke || true
exit 1
fi
docker rm -f mtg-smoke >/dev/null 2>&1 || true
- name: Docker Hub login
uses: docker/login-action@v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5.8.0
@ -81,15 +53,196 @@ jobs:
org.opencontainers.image.description=${{ steps.notes.outputs.desc }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Build and push
build_amd64:
name: Build (amd64)
runs-on: ubuntu-latest
needs: prepare
permissions:
contents: read
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
- name: Prepare amd64 tag list
id: arch_tags
shell: bash
run: |
echo "Generating amd64 tag variants" >&2
TAGS='${{ needs.prepare.outputs.tags }}'
echo "$TAGS" | sed 's/$/-amd64/' | grep . > tags.txt
echo "Computed tags:" >&2; cat tags.txt >&2
echo "tags<<EOF" >> $GITHUB_OUTPUT
cat tags.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Docker Hub login
uses: docker/login-action@v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.11.1
- name: Smoke test Web UI (local build)
shell: bash
env:
APP_VERSION: ${{ needs.prepare.outputs.version }}
run: |
docker buildx build --platform linux/amd64 --load -t mtg-deckbuilder:test --build-arg APP_VERSION=$APP_VERSION .
docker rm -f mtg-smoke 2>/dev/null || true
docker run -d --name mtg-smoke -p 8080:8080 mtg-deckbuilder:test
echo "Waiting for Web UI (amd64)..."
for i in {1..30}; do
if curl -fsS http://localhost:8080/ >/dev/null; then echo "Up"; break; fi
sleep 2
done
if ! curl -fsS http://localhost:8080/ >/dev/null; then
echo "Web UI did not start in time. Logs:" && docker logs mtg-smoke || true
exit 1
fi
docker rm -f mtg-smoke >/dev/null 2>&1 || true
- name: Build & push arch image (amd64)
id: build
uses: docker/build-push-action@v6.18.0
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
tags: ${{ steps.arch_tags.outputs.tags }}
labels: ${{ needs.prepare.outputs.labels }}
build-args: |
APP_VERSION=${{ steps.notes.outputs.version }}
APP_VERSION=${{ needs.prepare.outputs.version }}
build_arm64_native:
name: Build (arm64 native)
# Native ARM64 GitHub hosted runner; if unavailable replace with self-hosted label
runs-on: ubuntu-24.04-arm64
needs: prepare
permissions:
contents: read
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
- name: Prepare arm64 tag list
id: arch_tags
shell: bash
run: |
echo "Generating arm64 tag variants (native)" >&2
TAGS='${{ needs.prepare.outputs.tags }}'
echo "$TAGS" | sed 's/$/-arm64/' | grep . > tags.txt
echo "Computed tags:" >&2; cat tags.txt >&2
echo "tags<<EOF" >> $GITHUB_OUTPUT
cat tags.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Docker Hub login
uses: docker/login-action@v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.11.1
- name: Build & push arch image (arm64 native)
id: build
uses: docker/build-push-action@v6.18.0
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/arm64
tags: ${{ steps.arch_tags.outputs.tags }}
labels: ${{ needs.prepare.outputs.labels }}
build-args: |
APP_VERSION=${{ needs.prepare.outputs.version }}
build_arm64_emulated:
name: Build (arm64 emulated fallback)
runs-on: ubuntu-latest
needs: [prepare, build_arm64_native]
if: needs.build_arm64_native.result == 'failure'
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
- name: Prepare arm64 tag list (fallback)
id: arch_tags
shell: bash
run: |
echo "Generating arm64 tag variants (fallback)" >&2
TAGS='${{ needs.prepare.outputs.tags }}'
echo "$TAGS" | sed 's/$/-arm64/' | grep . > tags.txt
echo "tags<<EOF" >> $GITHUB_OUTPUT
cat tags.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Docker Hub login
uses: docker/login-action@v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU (for emulation)
uses: docker/setup-qemu-action@v3.6.0
- name: Set up Buildx
uses: docker/setup-buildx-action@v3.11.1
- name: Build & push arch image (arm64 emulated)
uses: docker/build-push-action@v6.18.0
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/arm64
tags: ${{ steps.arch_tags.outputs.tags }}
labels: ${{ needs.prepare.outputs.labels }}
build-args: |
APP_VERSION=${{ needs.prepare.outputs.version }}
manifest:
name: Create multi-arch manifests
runs-on: ubuntu-latest
needs: [prepare, build_amd64, build_arm64_native, build_arm64_emulated]
steps:
- name: Docker Hub login
uses: docker/login-action@v3.5.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create & push manifests
shell: bash
env:
TAGS: ${{ needs.prepare.outputs.tags }}
run: |
echo "Creating multi-arch manifests (native preferred, fallback if needed)..."
echo "$TAGS" | while read -r tag; do
[ -z "$tag" ] && continue
echo "Processing $tag"
SOURCES="${tag}-amd64"
if docker buildx imagetools inspect "${tag}-arm64" >/dev/null 2>&1; then
echo "Found arm64 image tag: ${tag}-arm64"
SOURCES="$SOURCES ${tag}-arm64"
else
echo "No arm64 image found for $tag (skipping arm64 in manifest)" >&2
fi
docker buildx imagetools create -t "$tag" $SOURCES
done
echo "Done."
- name: Inspect primary tag
run: |
FIRST=$(echo "$TAGS" | head -n1)
docker buildx imagetools inspect "$FIRST"