Files
wehub-resource-sync 4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

149 lines
4.8 KiB
YAML

name: Docker Publish
on:
release:
types: [published]
schedule:
- cron: "30 2 * * *"
workflow_dispatch:
inputs:
tag:
description: "Release tag to build (e.g. v0.1.2026.7.8). Defaults to the latest release."
required: false
type: string
permissions:
contents: read
packages: write
concurrency:
group: docker-publish
cancel-in-progress: false
jobs:
build-and-push:
if: github.repository == 'Tracer-Cloud/opensre'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve release tag and image tags
id: meta
env:
EVENT_NAME: ${{ github.event_name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
DISPATCH_TAG: ${{ inputs.tag }}
shell: bash
run: |
set -euo pipefail
image="ghcr.io/${GITHUB_REPOSITORY,,}"
latest_tag="$(gh api "repos/${GITHUB_REPOSITORY}/releases/latest" --jq .tag_name)"
case "$EVENT_NAME" in
release)
if [ "$RELEASE_PRERELEASE" = "true" ]; then
echo "Skipping prerelease $RELEASE_TAG (rolling main builds are not published to GHCR)."
echo "build=false" >> "$GITHUB_OUTPUT"
exit 0
fi
tag="$RELEASE_TAG"
;;
workflow_dispatch)
tag="${DISPATCH_TAG:-$latest_tag}"
gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null
;;
*)
tag="$latest_tag"
;;
esac
version="${tag#v}"
# The scheduled run rebuilds the newest release; skip it when that
# version is already in the registry (e.g. the release event or a
# dispatch already published it).
if [ "$EVENT_NAME" = "schedule" ] \
&& docker manifest inspect "${image}:${version}" >/dev/null 2>&1; then
echo "Image ${image}:${version} already published; nothing to do."
echo "build=false" >> "$GITHUB_OUTPUT"
exit 0
fi
tags="${image}:${version}"
if [ "$tag" = "$latest_tag" ]; then
tags="${tags}"$'\n'"${image}:latest"
else
echo "Tag $tag is older than latest release $latest_tag; not moving :latest."
fi
{
echo "build=true"
echo "tag=${tag}"
echo "version=${version}"
echo "image=${image}"
echo "tags<<EOF"
echo "$tags"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v5
if: steps.meta.outputs.build == 'true'
with:
ref: ${{ steps.meta.outputs.tag }}
- name: Sync release version into pyproject.toml
if: steps.meta.outputs.build == 'true'
shell: bash
run: python3 platform/packaging/sync_release_version.py --tag "${{ steps.meta.outputs.tag }}"
- name: Set up QEMU
if: steps.meta.outputs.build == 'true'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: steps.meta.outputs.build == 'true'
uses: docker/setup-buildx-action@v3
- name: Build and push image
if: steps.meta.outputs.build == 'true'
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
org.opencontainers.image.title=opensre
org.opencontainers.image.description=OpenSRE unified image (MODE=web FastAPI health app, MODE=gateway Telegram gateway)
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=${{ steps.meta.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test published image
if: steps.meta.outputs.build == 'true'
shell: bash
run: |
set -euo pipefail
image="${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}"
docker pull "$image"
version_output="$(docker run --rm --entrypoint opensre "$image" --version)"
printf '%s\n' "$version_output"
case "$version_output" in
*"${{ steps.meta.outputs.version }}"*) ;;
*)
echo "Image version mismatch: expected ${{ steps.meta.outputs.version }}" >&2
exit 1
;;
esac