Skip to content

Prepare hashavatar-api 1.1.1 #13

Prepare hashavatar-api 1.1.1

Prepare hashavatar-api 1.1.1 #13

Workflow file for this run

name: Container Images
on:
workflow_dispatch:
inputs:
platforms:
description: OCI platforms to build.
required: true
default: linux/amd64
push:
tags:
- "v*"
permissions:
contents: read
packages: write
env:
CARGO_TERM_COLOR: always
jobs:
wolfi:
name: Build and publish Wolfi image
runs-on: ubuntu-latest
timeout-minutes: 60
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v4.2.0
- name: Set up Buildx
uses: docker/setup-buildx-action@v4.2.0
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare tags
id: tags
shell: bash
run: |
set -euo pipefail
short_sha="${GITHUB_SHA::12}"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
version="${GITHUB_REF_NAME}"
else
version="dev"
fi
tags=(
"ghcr.io/${GITHUB_REPOSITORY}:${version}"
"ghcr.io/${GITHUB_REPOSITORY}:${version}-wolfi"
"ghcr.io/${GITHUB_REPOSITORY}:sha-${short_sha}-wolfi"
)
if [[ "${GITHUB_REF_NAME}" == "${DEFAULT_BRANCH}" ]]; then
tags+=(
"ghcr.io/${GITHUB_REPOSITORY}:latest"
"ghcr.io/${GITHUB_REPOSITORY}:latest-wolfi"
)
fi
{
echo "tags<<EOF"
printf '%s\n' "${tags[@]}"
echo "EOF"
} >> "${GITHUB_OUTPUT}"
- name: Build and publish Wolfi image
uses: docker/build-push-action@v7.3.0
with:
context: .
file: Dockerfile
platforms: ${{ inputs.platforms || 'linux/amd64' }}
push: true
cache-from: type=gha,scope=wolfi
cache-to: type=gha,mode=max,scope=wolfi
labels: |
org.opencontainers.image.title=hashavatar-api
org.opencontainers.image.description=Public avatar API and demo website for hashavatar
org.opencontainers.image.licenses=EUPL-1.2
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ github.ref_name }}
tags: ${{ steps.tags.outputs.tags }}