Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image to Docker Hub | |
| on: | |
| workflow_dispatch: # 手动触发 | |
| release: | |
| types: [published] # 发布 release 时自动触发 | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. 检出当前仓库代码 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. 设置 QEMU (用于跨平台构建 ARM64) | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # 3. 设置 Docker Buildx (用于构建镜像的高级工具) | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # 4. 登录到 Docker Hub (使用你截图里配置的 Secrets) | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # 5. 构建并推送镜像 (支持 AMD64 和 ARM64) | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:latest | |
| ${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:${{ github.sha }} | |
| ${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:${{ github.ref_name || github.event.release.tag_name }} |