MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / src / mojollama / .github / workflows / docker-publish.yml
| 1 | name: Build and publish Docker image |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | tags: |
| 7 | - "v*" |
| 8 | pull_request: |
| 9 | branches: [main] |
| 10 | workflow_dispatch: |
| 11 | |
| 12 | env: |
| 13 | REGISTRY: ghcr.io |
| 14 | IMAGE_NAME: ${{ github.repository }} |
| 15 | |
| 16 | jobs: |
| 17 | build-and-push: |
| 18 | runs-on: ubuntu-latest |
| 19 | permissions: |
| 20 | contents: read |
| 21 | packages: write |
| 22 | |
| 23 | steps: |
| 24 | - name: Checkout repository |
| 25 | uses: actions/checkout@v4 |
| 26 | |
| 27 | - name: Log in to GitHub Container Registry |
| 28 | uses: docker/login-action@v3 |
| 29 | with: |
| 30 | registry: ${{ env.REGISTRY }} |
| 31 | username: ${{ github.actor }} |
| 32 | password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | |
| 34 | - name: Extract Docker metadata |
| 35 | id: meta |
| 36 | uses: docker/metadata-action@v5 |
| 37 | with: |
| 38 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 39 | tags: | |
| 40 | type=semver,pattern={{version}} |
| 41 | type=semver,pattern={{major}}.{{minor}} |
| 42 | type=ref,event=branch |
| 43 | type=sha,prefix= |
| 44 | type=raw,value=latest,enable={{is_default_branch}} |
| 45 | |
| 46 | - name: Build and push Docker image |
| 47 | uses: docker/build-push-action@v6 |
| 48 | with: |
| 49 | context: . |
| 50 | push: ${{ github.event_name != 'pull_request' }} |
| 51 | tags: ${{ steps.meta.outputs.tags }} |
| 52 | labels: ${{ steps.meta.outputs.labels }} |