80 lines
2.7 KiB
YAML
80 lines
2.7 KiB
YAML
|
|
# Forgejo Actions — Docker image publish for Dragon Fork.
|
||
|
|
#
|
||
|
|
# Triggers on semver tags (v*.*.*-dragonfork or v*.*.*). Builds a
|
||
|
|
# multi-arch image (linux/amd64 + linux/arm64) and pushes to the
|
||
|
|
# configured registry. The image name and registry are controlled by
|
||
|
|
# repository variables:
|
||
|
|
#
|
||
|
|
# REGISTRY — e.g. ghcr.io or registry.wilddragon.net
|
||
|
|
# IMAGE_NAME — e.g. zgaetano/dragonfork-core (defaults to repo name)
|
||
|
|
#
|
||
|
|
# The push credential must be stored as a repository secret:
|
||
|
|
# REGISTRY_TOKEN — password / token for the registry user
|
||
|
|
# REGISTRY_USER — registry username (defaults to repo owner)
|
||
|
|
#
|
||
|
|
# Quick-start after setting the variables/secrets:
|
||
|
|
# git tag v0.2.0-dragonfork && git push origin v0.2.0-dragonfork
|
||
|
|
|
||
|
|
name: publish
|
||
|
|
|
||
|
|
on:
|
||
|
|
push:
|
||
|
|
tags:
|
||
|
|
- 'v*.*.*'
|
||
|
|
- 'v*.*.*-dragonfork'
|
||
|
|
|
||
|
|
jobs:
|
||
|
|
build-and-push:
|
||
|
|
name: Build and push multi-arch image
|
||
|
|
runs-on: ubuntu-22.04
|
||
|
|
permissions:
|
||
|
|
contents: read
|
||
|
|
packages: write
|
||
|
|
|
||
|
|
steps:
|
||
|
|
- uses: actions/checkout@v4
|
||
|
|
|
||
|
|
- name: Set up QEMU (for arm64 cross-build)
|
||
|
|
uses: docker/setup-qemu-action@v3
|
||
|
|
|
||
|
|
- name: Set up Docker Buildx
|
||
|
|
uses: docker/setup-buildx-action@v3
|
||
|
|
|
||
|
|
- name: Derive image metadata
|
||
|
|
id: meta
|
||
|
|
run: |
|
||
|
|
REGISTRY="${{ vars.REGISTRY || 'ghcr.io' }}"
|
||
|
|
IMAGE="${{ vars.IMAGE_NAME || github.repository }}"
|
||
|
|
TAG="${GITHUB_REF_NAME}"
|
||
|
|
# Normalise: strip leading 'v' for the semver part, keep full tag too
|
||
|
|
SEMVER="${TAG#v}"
|
||
|
|
echo "image=${REGISTRY}/${IMAGE}" >> "$GITHUB_OUTPUT"
|
||
|
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||
|
|
echo "semver=${SEMVER}" >> "$GITHUB_OUTPUT"
|
||
|
|
|
||
|
|
- name: Login to registry
|
||
|
|
uses: docker/login-action@v3
|
||
|
|
with:
|
||
|
|
registry: ${{ vars.REGISTRY || 'ghcr.io' }}
|
||
|
|
username: ${{ vars.REGISTRY_USER || github.repository_owner }}
|
||
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||
|
|
|
||
|
|
- name: Build and push
|
||
|
|
uses: docker/build-push-action@v5
|
||
|
|
with:
|
||
|
|
context: .
|
||
|
|
file: Dockerfile
|
||
|
|
platforms: linux/amd64,linux/arm64
|
||
|
|
push: true
|
||
|
|
tags: |
|
||
|
|
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.tag }}
|
||
|
|
${{ steps.meta.outputs.image }}:latest
|
||
|
|
labels: |
|
||
|
|
org.opencontainers.image.title=Dragon Fork Core
|
||
|
|
org.opencontainers.image.description=Datarhei Core with WebRTC egress
|
||
|
|
org.opencontainers.image.version=${{ steps.meta.outputs.semver }}
|
||
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
||
|
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
||
|
|
cache-from: type=gha
|
||
|
|
cache-to: type=gha,mode=max
|