mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-25 07:31:32 +08:00
Restricting Build Dev Image to master (f8487471c) still left every master
push publishing a permanent rockchin/langbot:sha-<sha> tag, about ten a day.
A push now only moves the master tag. The immutable sha-<sha> tag used for
Cloud promotion is published only by workflow_dispatch (immutable_tag input,
default true), and each run writes the pushed index digest to the job summary.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
94 lines
3.1 KiB
YAML
94 lines
3.1 KiB
YAML
name: Build Dev Image
|
|
|
|
# Tag churn control: every push used to publish a permanent
|
|
# `rockchin/langbot:sha-<sha>` tag plus a branch-name tag, so ~265 feature,
|
|
# agent, experiment and test branches had each accumulated dozens of Docker Hub
|
|
# tags (678 live tags, 467 of them `sha-*`). Only `master` now builds on push;
|
|
# any other branch can still be built through workflow_dispatch.
|
|
#
|
|
# Master pushes alone still added ~10 `sha-*` tags a day (LANG-417), so a push
|
|
# now only moves the `master` tag. The immutable `sha-<sha>` tag that Cloud
|
|
# promotion pins is opt-in: dispatch this workflow on the commit's branch with
|
|
# `immutable_tag` checked (the default). Every run records the pushed index
|
|
# digest in the job summary.
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "plugins/**"
|
|
- ".github/workflows/plugins-*.yml"
|
|
workflow_dispatch:
|
|
inputs:
|
|
immutable_tag:
|
|
description: "Also publish the immutable rockchin/langbot:sha-<commit> tag"
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
build-dev-image:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Generate image metadata
|
|
id: image
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
branch_tag="${GITHUB_REF#refs/heads/}"
|
|
branch_tag="${branch_tag//\//-}"
|
|
tags="rockchin/langbot:${branch_tag}"
|
|
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${IMMUTABLE_TAG}" == "true" ]]; then
|
|
tags+=$'\n'"rockchin/langbot:sha-${GITHUB_SHA}"
|
|
fi
|
|
{
|
|
echo "tags<<EOF"
|
|
echo "${tags}"
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
env:
|
|
IMMUTABLE_TAG: ${{ inputs.immutable_tag }}
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push Core image
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
build-args: |
|
|
LANGBOT_BUILD_REVISION=${{ github.sha }}
|
|
tags: ${{ steps.image.outputs.tags }}
|
|
labels: |
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
|
|
|
- name: Record image digest
|
|
shell: bash
|
|
env:
|
|
TAGS: ${{ steps.image.outputs.tags }}
|
|
DIGEST: ${{ steps.build.outputs.digest }}
|
|
run: |
|
|
{
|
|
echo "### rockchin/langbot"
|
|
echo
|
|
echo "- commit: \`${GITHUB_SHA}\`"
|
|
echo "- digest: \`rockchin/langbot@${DIGEST}\`"
|
|
while IFS= read -r tag; do echo "- tag: \`${tag}\`"; done <<< "${TAGS}"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|