Skip to content

Publish

Publish #19

name: "Publish"
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
arch: ["amd64", "aarch64"]
steps:
- name: Checkout the repository
uses: actions/checkout@v6
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
- name: Get BUILD_VERSION
run: echo "$(grep "ARG BUILD_VERSION=" docker/Dockerfile | cut -d' ' -f2 | tr -d '"')" >> $GITHUB_ENV
- name: Get platform
run: echo "PLATFORM=$(echo ${{ matrix.arch }} | sed -e 's/aarch64/amd64/g')" >> $GITHUB_ENV
- name: Build and publish
uses: docker/build-push-action@master
with:
context: docker
push: true
platforms: ${{ env.PLATFORM }}
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.BUILD_VERSION }}
build-args: |
"BUILD_ARCH=${{ matrix.arch }}"