mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-07 00:02:54 +08:00
Every branch push published a permanent rockchin/langbot:sha-<sha> tag plus a branch-name tag, leaving 678 live Docker Hub tags across 265 branches. Restrict push triggers to master; other branches stay buildable via workflow_dispatch. Co-authored-by: multica-agent <[email protected]>
61 lines
1.9 KiB
YAML
61 lines
1.9 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.
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "plugins/**"
|
|
- ".github/workflows/plugins-*.yml"
|
|
workflow_dispatch:
|
|
|
|
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//\//-}"
|
|
echo "branch_tag=${branch_tag}" >> "$GITHUB_OUTPUT"
|
|
echo "sha_tag=sha-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push immutable Core image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
build-args: |
|
|
LANGBOT_BUILD_REVISION=${{ github.sha }}
|
|
tags: |
|
|
rockchin/langbot:${{ steps.image.outputs.branch_tag }}
|
|
rockchin/langbot:${{ steps.image.outputs.sha_tag }}
|
|
labels: |
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|