Skip to content
name: Publish Docker 🐳 images πŸ“¦ to GitHub Container Registry
on:
release:
types: [created]
workflow_dispatch: {}
jobs:
build-and-publish-to-ghcr:
permissions:
packages: write
name: Build and publish Docker 🐳 images πŸ“¦ to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract metadata (tags/labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
file: dist.Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}