| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- # 自动构建并推送 GHCR:push master 触发
- # 镜像 tag:latest + 日期时间 - 提交哈希(如 20260815T0054-a1b2c3d)
- #
- # Auto-build and push to GHCR: triggered on push to master
- # Image tags: latest + datetime-commit-hash (e.g. 20260815T0054-a1b2c3d)
- name: build-push-ghcr
- on:
- push:
- branches: [master]
- env:
- IMAGE: ghcr.io/xidong-ai/deepseek-harness-web-docker
- jobs:
- # 推送前冒烟:构建镜像并跑端到端检查(basic auth / 特权 API fence / 双进程 / trustedHosts 注入),失败则不推送
- # 手动 push 的代码不再未经验证直接发布
- #
- # Pre-push smoke test: build the image and run end-to-end checks (basic auth / privileged-API fence /
- # both processes / trustedHosts injection); a failure blocks the push, so manually pushed code
- # is no longer published unverified
- verify:
- runs-on: ubuntu-latest
- permissions:
- contents: read
- steps:
- - uses: actions/checkout@v4
- - name: 提取 DSH_VERSION
- id: version
- run: |
- echo "version=$(grep -E '^ARG DSH_VERSION=' Dockerfile | head -n1 | cut -d= -f2)" >> "$GITHUB_OUTPUT"
- - name: 构建并冒烟测试
- run: |
- scripts/smoke-test.sh "${{ steps.version.outputs.version }}"
- build:
- needs: verify
- runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
- steps:
- - uses: actions/checkout@v4
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Log in to GHCR
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: 生成日期时间 - 哈希 tag
- id: meta
- run: |
- echo "tag=$(date +%Y%m%dT%H%M)-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- - name: Build and push
- uses: docker/build-push-action@v6
- with:
- context: .
- push: true
- platforms: linux/amd64,linux/arm64
- tags: |
- ${{ env.IMAGE }}:latest
- ${{ env.IMAGE }}:${{ steps.meta.outputs.tag }}
|