name: Publish Docker Images on: push: tags: - "v*" workflow_dispatch: permissions: contents: write packages: write concurrency: group: docker-publish-${{ github.ref }} cancel-in-progress: true env: REGISTRY: ghcr.io IMAGE_NAME: tatertotterson/microwakeword jobs: docker: name: Docker image runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | latest=false tags: | type=raw,value=latest type=ref,event=tag - name: Build and push image uses: docker/build-push-action@v6 with: context: . file: dockerfile platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha,scope=mww-trainer-nvidia-docker cache-to: type=gha,mode=max,scope=mww-trainer-nvidia-docker - name: Docker metadata (Blackwell) id: meta-blackwell uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | latest=false tags: | type=raw,value=blackwell type=ref,event=tag,suffix=-blackwell - name: Build and push Blackwell image uses: docker/build-push-action@v6 with: context: . file: dockerfile.blackwell platforms: linux/amd64 push: true tags: ${{ steps.meta-blackwell.outputs.tags }} labels: ${{ steps.meta-blackwell.outputs.labels }} cache-from: type=gha,scope=mww-trainer-nvidia-docker-blackwell cache-to: type=gha,mode=max,scope=mww-trainer-nvidia-docker-blackwell - name: Create release notes if: startsWith(github.ref, 'refs/tags/') env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAG_NAME: ${{ github.ref_name }} REPO: ${{ github.repository }} run: | set -euo pipefail title="microWakeWord Nvidia Trainer ${TAG_NAME}" generated_notes="$(mktemp)" release_notes="$(mktemp)" gh api "repos/${REPO}/releases/generate-notes" \ -f tag_name="${TAG_NAME}" \ -f target_commitish="${GITHUB_SHA}" \ --jq '.body' > "${generated_notes}" { echo "## Docker Images" echo echo "- \`ghcr.io/tatertotterson/microwakeword:${TAG_NAME}\`" echo "- \`ghcr.io/tatertotterson/microwakeword:latest\`" echo "- \`ghcr.io/tatertotterson/microwakeword:${TAG_NAME}-blackwell\`" echo "- \`ghcr.io/tatertotterson/microwakeword:blackwell\`" echo cat "${generated_notes}" } > "${release_notes}" if gh release view "${TAG_NAME}" >/dev/null 2>&1; then gh release edit "${TAG_NAME}" \ --title "${title}" \ --notes-file "${release_notes}" \ --latest \ --verify-tag else gh release create "${TAG_NAME}" \ --title "${title}" \ --notes-file "${release_notes}" \ --latest \ --verify-tag fi