Skip to content

ci: push to ghcr.io (again) #29

ci: push to ghcr.io (again)

ci: push to ghcr.io (again) #29

Workflow file for this run

# This action pushes new amd64 and arm64 docker images to the Docker and GitHub
# registries on every new release of the project.
#
# Cobbled together from these sources:
# - https://github.com/docker/build-push-action/#usage
# - https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
name: Release
"on":
release:
types: [published]
pull_request:
branches: [main]
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: pr-sha
if: github.event_name == 'pull_request'
run: echo "sha=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
- uses: docker/metadata-action@v5
with:
images: |
mccutchen/go-httpbin
ghcr.io/${{ github.repository }}
tags: |
# For releases, use the standard tags and special "latest" tag
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
# For pull requests, use the commit SHA
type=raw,value=${{ steps.pr-sha.outputs.sha }},enable=${{ github.event_name == 'pull_request' }}
id: meta
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
sbom: true
provenance: mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}