name: docker on: push: branches: - 'main' jobs: build-and-publish: name: Build & Publish runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@main - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GHCR_TOKEN }} - name: Build and push Docker image to ghcr.io uses: docker/build-push-action@v2 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}