name: release package
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., 0.1.0)"
required: true
type: string
push:
tags:
- "v*.*.*"
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-deb:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- run: |
docker build \
--file ./builder.dockerfile \
--output ./target/debian \
--platform linux/${{ matrix.arch }} \
.
- name: find .deb file
id: find_deb
run: |
deb_file=$(find ./target/debian -name "*.deb" | head -n 1)
echo "deb_file=$deb_file" >> $GITHUB_OUTPUT
- name: upload .deb to release
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.find_deb.outputs.deb_file }}
tag_name: ${{ github.event.inputs.version || github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: set up QEMU
uses: docker/setup-qemu-action@v3
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: build and push multiarch Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max