|
83 | 83 | file: target/${{ matrix.target }}/release-ci/${{ matrix.artifact_name }} |
84 | 84 | asset_name: ${{ matrix.release_name }} |
85 | 85 | tag: ${{ github.ref }} |
| 86 | + |
| 87 | + docker: |
| 88 | + name: Build and Push Docker Image |
| 89 | + runs-on: ubuntu-latest |
| 90 | + needs: publish |
| 91 | + if: startsWith(github.ref, 'refs/tags/v') |
| 92 | + permissions: |
| 93 | + contents: read |
| 94 | + packages: write |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v6 |
| 97 | + |
| 98 | + - name: Set up QEMU |
| 99 | + uses: docker/setup-qemu-action@v3 |
| 100 | + |
| 101 | + - name: Set up Docker Buildx |
| 102 | + uses: docker/setup-buildx-action@v3 |
| 103 | + |
| 104 | + - name: Login to GitHub Container Registry |
| 105 | + if: startsWith(github.ref, 'refs/tags/v') |
| 106 | + uses: docker/login-action@v3 |
| 107 | + with: |
| 108 | + registry: ghcr.io |
| 109 | + username: ${{ github.actor }} |
| 110 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 111 | + |
| 112 | + - name: Extract metadata (tags, labels) |
| 113 | + id: meta |
| 114 | + uses: docker/metadata-action@v5 |
| 115 | + with: |
| 116 | + images: ghcr.io/${{ github.repository }} |
| 117 | + tags: | |
| 118 | + type=semver,pattern={{version}} |
| 119 | + type=semver,pattern={{major}}.{{minor}} |
| 120 | + type=semver,pattern={{major}} |
| 121 | + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} |
| 122 | +
|
| 123 | + - name: Build and push |
| 124 | + uses: docker/build-push-action@v6 |
| 125 | + with: |
| 126 | + context: . |
| 127 | + platforms: linux/amd64,linux/arm64 |
| 128 | + push: ${{ startsWith(github.ref, 'refs/tags/v') }} |
| 129 | + tags: ${{ steps.meta.outputs.tags }} |
| 130 | + labels: ${{ steps.meta.outputs.labels }} |
| 131 | + cache-from: type=gha |
| 132 | + cache-to: type=gha,mode=max |
0 commit comments