Skip to content

Build & Publish Container Image #2

Build & Publish Container Image

Build & Publish Container Image #2

Workflow file for this run

name: "Build & Publish Container Image"
on:
workflow_call:
inputs:
tag:
type: string
required: true
workflow_dispatch:
inputs:
tag:
description: "Tag (e.g. liwan-v0.1.0)"
required: true
type: string
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Extract Semver
id: semver
run: |
SEMVER_VERSION=$(echo "${{ github.event.inputs.tag }}" | sed -E 's/liwan-v//')
echo "SEMVER_VERSION=${SEMVER_VERSION}" >> "$GITHUB_OUTPUT"
- name: Setup Docker Metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.actor }}/liwan
tags: |
type=semver,pattern={{version}},value=${{ steps.semver.outputs.SEMVER_VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semver.outputs.SEMVER_VERSION }}
type=semver,pattern={{major}},value=${{ steps.semver.outputs.SEMVER_VERSION }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
linux/arm64
build-args: |
TAR_URL_AMD64=https://github.com/explodingcamera/liwan/releases/download/${{ github.ref_name }}/liwan-amd64-linux.tar.gz
TAR_URL_ARM64=https://github.com/explodingcamera/liwan/releases/download/${{ github.ref_name }}/liwan-aarch64-linux.tar.gz