Publish Docker image #30
This file contains 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 image | ||
# Tagging a release 'vX' will create an image named "paulgalow/racoder:vX" and one for ":latest" | ||
# Tagging a release with 'unstable' will create an image named "paulgalow/racoder:unstable" | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
workflow_dispatch: # Enables manual triggering | ||
inputs: | ||
tags: | ||
description: "Please specify version tag to build and push" | ||
required: true | ||
jobs: | ||
push_to_registries: | ||
name: Push Docker image to multiple registries | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event_name == 'workflow_dispatch' && 'refs/tags/' + github.event.inputs.tag || github.ref }} | ||
Check failure on line 26 in .github/workflows/docker-image.yml GitHub Actions / Publish Docker imageInvalid workflow file
|
||
- name: Set up QEMU for more CPU architectures | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx for multi-platform builds | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=tag,prefix=v,format=latest # Apply 'latest' tag for versioned tags | ||
type=ref,event=tag,prefix=v # Apply versioned tag like 'v1.0.0' | ||
type=ref,event=tag,excludePrefix=v # Apply non-versioned tag | ||
type=input # Manual input | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |