Files
minstrel/.forgejo/workflows/release.yml
T
bvandeusen 0f9efed50c ci(release): add workflow_dispatch + pre-build docker diagnostics
Adds a manual-trigger hook so we don't need a fresh commit to re-run
this pipeline, and dumps docker/buildx state before the build so CI
failures are diagnosable without docker.sock guesswork.
2026-04-18 23:19:06 +00:00

76 lines
2.2 KiB
YAML

name: release
# Builds and pushes the minstrel container image to the Forgejo registry.
#
# push to main → :main
# push tag vX.Y.Z → :vX.Y.Z and :latest
# workflow_dispatch → manual trigger (same rules based on the ref)
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
jobs:
release:
runs-on: go-ci
env:
IMAGE: git.fabledsword.com/bvandeusen/minstrel
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect buildable project
id: guard
shell: bash
run: |
if [ -f Dockerfile ] && [ -f go.mod ]; then
echo "ready=true" >> "$GITHUB_OUTPUT"
else
echo "ready=false" >> "$GITHUB_OUTPUT"
echo "::notice::No Dockerfile + go.mod yet — release build skipped"
fi
- name: Docker environment diagnostics
if: steps.guard.outputs.ready == 'true'
shell: bash
run: |
echo "--- whoami + env ---"
id
echo "DOCKER_HOST=${DOCKER_HOST:-<unset>}"
ls -la /var/run/docker.sock || echo "NO socket at /var/run/docker.sock"
echo "--- docker info ---"
docker version || true
docker info || true
echo "--- buildx ---"
docker buildx version || true
docker buildx ls || true
- name: Compute image tags
id: tags
if: steps.guard.outputs.ready == 'true'
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
echo "args=-t ${IMAGE}:${VERSION} -t ${IMAGE}:latest" >> "$GITHUB_OUTPUT"
echo "::notice::Release build: ${VERSION} + latest"
else
echo "args=-t ${IMAGE}:main" >> "$GITHUB_OUTPUT"
echo "::notice::Main-branch build: :main"
fi
- name: Registry login
if: steps.guard.outputs.ready == 'true'
shell: bash
run: |
echo "${{ secrets.GITHUB_TOKEN }}" \
| docker login git.fabledsword.com -u "${{ github.actor }}" --password-stdin
- name: Build and push
if: steps.guard.outputs.ready == 'true'
run: docker buildx build --push ${{ steps.tags.outputs.args }} .