The channel work assumed the branch model it was written against: upstream, main is a release branch and dev-be is the trunk. Neither holds here. main IS our trunk - 212 commits past v0.11.3 - and a release is a tag (ADR-007). dev-be does not exist at all, so the edge half would never have fired and the launchers would have cloned a missing branch. Taken literally it would have published our unreleased trunk to every site as :stable, which is the opposite of what the word promises to someone who has no way to check. Remapped throughout: tag v* -> :stable the thing that was actually released main -> :edge the trunk, DEV badge lit publish-images.yml keys the channel on github.ref_type = tag rather than on a branch name, so the mapping cannot silently drift back. Start-ShopDBDev.ps1, dev-bootstrap.ps1 and build-channel-installer.ps1 resolve stable to the newest v* tag via git ls-remote --sort=-v:refname, warning and falling back to main if a repo has no tags yet. DEV-BUILD-TEST.md follows. The push: trigger is commented out. Automatic publishing waits on someone confirming the GHCR package exists under this owner and deciding who may pull it; workflow_dispatch works meanwhile. Turning it on is one uncomment. All three scripts parse clean under pwsh, and the tag-selection expression was run against this repo rather than eyeballed. Per the standing rule, the runtime paths still want a pass in the win11 VM before anyone leans on them. Scope: product
94 lines
3.7 KiB
YAML
94 lines
3.7 KiB
YAML
# Build and publish per-channel container images to GHCR.
|
|
#
|
|
# WHY this exists: pilot dev workstations sit behind an inspecting proxy
|
|
# (Zscaler) that resets npm's many small fetches mid-install, so building the
|
|
# image FROM SOURCE on a pilot box is unreliable. These runners
|
|
# (arc-runner-set) install npm cleanly - the CI `frontend` job already proves
|
|
# it - so we build the image ONCE here and pilots pull the finished image.
|
|
# A single image pull is one resumable HTTPS stream, far more robust through
|
|
# the proxy than hundreds of npm requests.
|
|
#
|
|
# Channels are mapped to how THIS repo actually ships, which is not how the
|
|
# branch this came from ships. Upstream, main is a release branch and dev-be is
|
|
# the trunk. Here main IS the trunk - it runs hundreds of commits past the last
|
|
# release - and releases are tags (ADR-007). Publishing main as :stable would
|
|
# put unreleased work behind a word that promises the opposite, to sites that
|
|
# have no way to know:
|
|
#
|
|
# tag v* -> ghcr.io/<owner>/shopdb-flask:stable (badge off) the release
|
|
# main -> ghcr.io/<owner>/shopdb-flask:edge (DEV badge) the trunk
|
|
#
|
|
# The image also carries a short-SHA tag for traceability and rollback.
|
|
#
|
|
# Automatic publishing is OFF until someone confirms the GHCR package exists
|
|
# under this owner and decides who may pull it. Re-enable by uncommenting the
|
|
# push: block below; workflow_dispatch works meanwhile.
|
|
|
|
name: publish-images
|
|
|
|
on:
|
|
# push:
|
|
# tags:
|
|
# - 'v*'
|
|
# branches:
|
|
# - main
|
|
# Manual rebuild/publish of the current ref's channel image.
|
|
workflow_dispatch:
|
|
|
|
# One in-flight publish per branch; a newer push supersedes an older one.
|
|
concurrency:
|
|
group: publish-images-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: arc-runner-set
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
# Lowercase the owner: GHCR repository paths must be lowercase, but
|
|
# github.repository_owner can carry uppercase (e.g. ge-aero is fine, but
|
|
# this keeps the workflow correct for any owner casing).
|
|
- name: Resolve image name and channel tag
|
|
id: meta
|
|
run: |
|
|
owner="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')"
|
|
image="ghcr.io/${owner}/shopdb-flask"
|
|
# A tag is a release, anything else is the trunk. Deliberately not
|
|
# keyed on the branch name: a release here is a tag, so keying on
|
|
# "main" would label the trunk stable.
|
|
if [ "${{ github.ref_type }}" = "tag" ]; then
|
|
channel="stable"
|
|
else
|
|
channel="edge"
|
|
fi
|
|
echo "image=${image}" >> "$GITHUB_OUTPUT"
|
|
echo "channel=${channel}" >> "$GITHUB_OUTPUT"
|
|
echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push channel image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.channel }}
|
|
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.channel }}-${{ steps.meta.outputs.sha }}
|
|
# Reuse the channel tag as a cache source/target so subsequent builds
|
|
# only redo layers that actually changed.
|
|
cache-from: type=registry,ref=${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.channel }}
|
|
cache-to: type=inline
|