Fixes #63
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: Publish Docker Images | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers on tags like v4.0.0, v5.1.2, etc. | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| flavor: [cpu, cuda] # This creates two jobs: one for cpu, one for cuda | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.${{ matrix.flavor }} | |
| push: true | |
| # This constructs the exact tags you requested: | |
| # 1. :flavor-latest (e.g., :cpu-latest) | |
| # 2. :flavor-tag (e.g., :cpu-v4.0.0) | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.flavor }}-latest | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.flavor }}-${{ github.ref_name }} | |
| labels: ${{ steps.meta.outputs.labels }} |