docker-build.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # 自动构建并推送 GHCR:push master 触发
  2. # 镜像 tag:latest + 日期时间 - 提交哈希(如 20260815T0054-a1b2c3d)
  3. #
  4. # Auto-build and push to GHCR: triggered on push to master
  5. # Image tags: latest + datetime-commit-hash (e.g. 20260815T0054-a1b2c3d)
  6. name: build-push-ghcr
  7. on:
  8. push:
  9. branches: [master]
  10. env:
  11. IMAGE: ghcr.io/xidong-ai/deepseek-harness-web-docker
  12. jobs:
  13. build:
  14. runs-on: ubuntu-latest
  15. permissions:
  16. contents: read
  17. packages: write
  18. steps:
  19. - uses: actions/checkout@v4
  20. - name: Set up QEMU
  21. uses: docker/setup-qemu-action@v3
  22. - name: Set up Docker Buildx
  23. uses: docker/setup-buildx-action@v3
  24. - name: Log in to GHCR
  25. uses: docker/login-action@v3
  26. with:
  27. registry: ghcr.io
  28. username: ${{ github.actor }}
  29. password: ${{ secrets.GITHUB_TOKEN }}
  30. - name: 生成日期时间 - 哈希 tag
  31. id: meta
  32. run: |
  33. echo "tag=$(date +%Y%m%dT%H%M)-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
  34. - name: Build and push
  35. uses: docker/build-push-action@v6
  36. with:
  37. context: .
  38. push: true
  39. platforms: linux/amd64,linux/arm64
  40. tags: |
  41. ${{ env.IMAGE }}:latest
  42. ${{ env.IMAGE }}:${{ steps.meta.outputs.tag }}