ci(docker): build ARM images on native runners

Refs #424

Thanks: INSOLVE (Honorary); Marco Jakobs (@jacotec); MyNameisStitch (@MyNameisStitch); Redspin (@playerumpknow)
This commit is contained in:
UNITRONIX
2026-09-17 02:34:26 +02:00
parent 13a4e79f04
commit e87703978b
9 changed files with 424 additions and 125 deletions
+5
View File
@@ -41,6 +41,11 @@ screenshots/
dev_modules/
TESTING.local.md
betterdesk-client/
betterdesk-desktop/
betterdesk-agent-client/
betterdesk-agent/
rdclient-desktop/
betterdesk-mgmt/
# Sensitive files
*.key
+350 -93
View File
@@ -9,14 +9,14 @@
# Tags:
# - main push: latest, sha-<commit>
# - dev push: dev, sha-<commit>
# - git tag v* / GitHub Release (stable): semver, v*, major.minor, latest
# - GitHub Release (stable): semver, v*, major.minor, latest
# - workflow_dispatch: latest + VERSION when tag empty/latest; else custom tag
#
# Branch pushes (main/dev): build ONLY on CI version-bump subjects
# (`chore: bump version … [version-bump]` / `chore: release version …`) so the
# GHCR image VERSION matches tip (auto-bump runs after the feature commit;
# building the feature SHA left :dev/:latest one patch behind — #401).
# Feature commits skip. Tag pushes, release, and workflow_dispatch always build.
# Feature commits skip. Releases and workflow_dispatch always build.
#
# Note: GITHUB_TOKEN pushes do not re-trigger workflows, so version-bump-dev
# dispatches this workflow with tag=dev after each successful bump.
@@ -41,7 +41,6 @@ on:
push:
branches: [main, dev]
tags: ['v*']
paths:
- 'Dockerfile*'
- 'docker-compose*.yml'
@@ -54,6 +53,12 @@ on:
release:
types: [published]
concurrency:
# Serialize image publication per ref/tag. A release is published by the
# release event only; the tag push is intentionally not a Docker trigger.
group: docker-publish-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || 'auto' }}
cancel-in-progress: false
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/${{ github.repository_owner }}
@@ -68,6 +73,11 @@ jobs:
version: ${{ steps.ver.outputs.version }}
steps:
- uses: actions/checkout@v6
- name: Validate manual publish tag
if: github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref != 'refs/heads/main'
run: |
echo "::error::The latest tag may only be published from main. Use tag=dev or a custom test tag such as dev-arm."
exit 1
- id: ver
run: |
if [ -f VERSION ]; then
@@ -78,18 +88,18 @@ jobs:
build-server:
needs: read-version
# Release/dispatch/tags always; branch pushes only on CI version-bump subjects (#401).
# Release/dispatch always; branch pushes only on CI version-bump subjects (#401).
# Match subject markers (chore: bump/release … [version-bump]), not incidental
# mentions of [version-bump] in a feature commit body.
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'release' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' &&
(startsWith(github.event.head_commit.message, 'chore: bump version') ||
startsWith(github.event.head_commit.message, 'chore: release version')) &&
contains(github.event.head_commit.message, '[version-bump]'))
runs-on: ubuntu-latest
timeout-minutes: 330
permissions:
contents: read
packages: write
@@ -117,75 +127,58 @@ jobs:
labels: |
org.opencontainers.image.version=${{ needs.read-version.outputs.version }}
tags: |
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest')) }}
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main') }}
type=raw,value=dev,enable=${{ (github.ref == 'refs/heads/dev' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, '-') && (github.event_name != 'workflow_dispatch' || !contains(github.event.inputs.tag, '-')) }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' && github.event.inputs.tag != 'latest' && github.event.inputs.tag != 'dev' }}
type=sha,prefix=sha-,enable=${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
- name: Resolve image for SBOM/Trivy
id: scanref
run: |
tag_line="$(echo "${{ steps.meta.outputs.tags }}" | grep -m1 'betterdesk-server:' || true)"
if [ -z "$tag_line" ]; then
tag_line="${{ env.IMAGE_PREFIX }}/betterdesk-server:latest"
fi
echo "image=$tag_line" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v6
- id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.server
push: true
tags: ${{ steps.meta.outputs.tags }}
outputs: type=image,name=${{ env.IMAGE_PREFIX }}/betterdesk-server,push-by-digest=true,name-canonical=true,push=true
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BETTERDESK_COMMIT_SHA=${{ github.sha }}
BETTERDESK_IMAGE_VERSION=${{ needs.read-version.outputs.version }}
BETTERDESK_PRODUCT_VERSION=${{ needs.read-version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=betterdesk-server-amd64
cache-to: type=gha,mode=max,scope=betterdesk-server-amd64
platforms: linux/amd64
- name: Generate SBOM
continue-on-error: true
uses: anchore/sbom-action@v0
env:
SYFT_REGISTRY_AUTH_USERNAME: ${{ github.actor }}
SYFT_REGISTRY_AUTH_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
image: ${{ steps.scanref.outputs.image }}
format: spdx-json
output-file: sbom-server.spdx.json
- name: Export image digest
run: |
set -euo pipefail
digest="${{ steps.build.outputs.digest }}"
test -n "$digest"
mkdir -p /tmp/digests/betterdesk-server
touch "/tmp/digests/betterdesk-server/${digest#sha256:}"
- name: Trivy vulnerability scan
continue-on-error: true
uses: aquasecurity/trivy-action@master
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Upload image digest
uses: actions/upload-artifact@v4
with:
image-ref: ${{ steps.scanref.outputs.image }}
format: table
exit-code: 0
severity: CRITICAL,HIGH
name: digests-server-amd64
path: /tmp/digests/betterdesk-server
if-no-files-found: error
build-console:
needs: read-version
# Release/dispatch/tags always; branch pushes only on CI version-bump subjects (#401).
# Release/dispatch always; branch pushes only on CI version-bump subjects (#401).
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'release' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' &&
(startsWith(github.event.head_commit.message, 'chore: bump version') ||
startsWith(github.event.head_commit.message, 'chore: release version')) &&
contains(github.event.head_commit.message, '[version-bump]'))
runs-on: ubuntu-latest
timeout-minutes: 330
permissions:
contents: read
packages: write
@@ -211,44 +204,58 @@ jobs:
labels: |
org.opencontainers.image.version=${{ needs.read-version.outputs.version }}
tags: |
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest')) }}
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main') }}
type=raw,value=dev,enable=${{ (github.ref == 'refs/heads/dev' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, '-') && (github.event_name != 'workflow_dispatch' || !contains(github.event.inputs.tag, '-')) }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' && github.event.inputs.tag != 'latest' && github.event.inputs.tag != 'dev' }}
type=sha,prefix=sha-,enable=${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
- uses: docker/build-push-action@v6
- id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.console
push: true
tags: ${{ steps.meta.outputs.tags }}
outputs: type=image,name=${{ env.IMAGE_PREFIX }}/betterdesk-console,push-by-digest=true,name-canonical=true,push=true
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BETTERDESK_COMMIT_SHA=${{ github.sha }}
BETTERDESK_IMAGE_VERSION=${{ needs.read-version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=betterdesk-console-amd64
cache-to: type=gha,mode=max,scope=betterdesk-console-amd64
platforms: linux/amd64
- name: Export image digest
run: |
set -euo pipefail
digest="${{ steps.build.outputs.digest }}"
test -n "$digest"
mkdir -p /tmp/digests/betterdesk-console
touch "/tmp/digests/betterdesk-console/${digest#sha256:}"
- name: Upload image digest
uses: actions/upload-artifact@v4
with:
name: digests-console-amd64
path: /tmp/digests/betterdesk-console
if-no-files-found: error
build-allinone:
needs: read-version
# Release/dispatch/tags always; branch pushes only on CI version-bump subjects (#401).
# Release/dispatch always; branch pushes only on CI version-bump subjects (#401).
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'release' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' &&
(startsWith(github.event.head_commit.message, 'chore: bump version') ||
startsWith(github.event.head_commit.message, 'chore: release version')) &&
contains(github.event.head_commit.message, '[version-bump]'))
runs-on: ubuntu-latest
# Multi-arch AIO on dev has hit the 6h Actions limit (#401); fail sooner if stuck.
timeout-minutes: 240
timeout-minutes: 330
permissions:
contents: read
packages: write
@@ -269,15 +276,9 @@ jobs:
- name: Resolve AIO platforms
id: plats
run: |
# :dev republish (branch push or dispatch tag=dev): amd64 only.
# Full multi-arch on main, tags, release, and other dispatch tags
# (e.g. workflow_dispatch tag=dev-arm for ARM retest — issue #385).
if { [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" = "refs/heads/dev" ]; } \
|| { [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.tag }}" = "dev" ]; }; then
echo "platforms=linux/amd64" >> "$GITHUB_OUTPUT"
else
echo "platforms=linux/amd64,linux/arm64" >> "$GITHUB_OUTPUT"
fi
# The amd64 leg is always built on the native amd64 runner.
# The arm64 leg is built separately on ubuntu-24.04-arm below.
echo "platforms=linux/amd64" >> "$GITHUB_OUTPUT"
- name: Extract metadata
id: meta
@@ -287,39 +288,302 @@ jobs:
labels: |
org.opencontainers.image.version=${{ needs.read-version.outputs.version }}
tags: |
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest')) }}
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main') }}
type=raw,value=dev,enable=${{ (github.ref == 'refs/heads/dev' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, '-') && (github.event_name != 'workflow_dispatch' || !contains(github.event.inputs.tag, '-')) }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' && github.event.inputs.tag != 'latest' && github.event.inputs.tag != 'dev' }}
type=sha,prefix=sha-,enable=${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
- uses: docker/build-push-action@v6
- id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
outputs: type=image,name=${{ env.IMAGE_PREFIX }}/betterdesk,push-by-digest=true,name-canonical=true,push=true
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BETTERDESK_COMMIT_SHA=${{ github.sha }}
BETTERDESK_IMAGE_VERSION=${{ needs.read-version.outputs.version }}
BETTERDESK_PRODUCT_VERSION=${{ needs.read-version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=betterdesk-aio-amd64
cache-to: type=gha,mode=max,scope=betterdesk-aio-amd64
platforms: ${{ steps.plats.outputs.platforms }}
- name: Export image digest
run: |
set -euo pipefail
digest="${{ steps.build.outputs.digest }}"
test -n "$digest"
mkdir -p /tmp/digests/betterdesk
touch "/tmp/digests/betterdesk/${digest#sha256:}"
- name: Upload image digest
uses: actions/upload-artifact@v4
with:
name: digests-aio-amd64
path: /tmp/digests/betterdesk
if-no-files-found: error
# Build the ARM64 legs on a native runner. This avoids the QEMU/npm
# combination that previously kept build-console running until the
# six-hour GitHub Actions limit.
build-arm64:
needs: read-version
if: |
(github.event_name == 'workflow_dispatch' ||
github.event_name == 'release' ||
(github.event_name == 'push' &&
(startsWith(github.event.head_commit.message, 'chore: bump version') ||
startsWith(github.event.head_commit.message, 'chore: release version')) &&
contains(github.event.head_commit.message, '[version-bump]')))
strategy:
fail-fast: false
matrix:
include:
- name: server
image: betterdesk-server
file: Dockerfile.server
- name: console
image: betterdesk-console
file: Dockerfile.console
runs-on: ubuntu-24.04-arm
timeout-minutes: 330
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.file }}
outputs: type=image,name=${{ env.IMAGE_PREFIX }}/${{ matrix.image }},push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.version=${{ needs.read-version.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
build-args: |
BETTERDESK_COMMIT_SHA=${{ github.sha }}
BETTERDESK_IMAGE_VERSION=${{ needs.read-version.outputs.version }}
BETTERDESK_PRODUCT_VERSION=${{ needs.read-version.outputs.version }}
cache-from: type=gha,scope=betterdesk-${{ matrix.name }}-arm64
cache-to: type=gha,mode=max,scope=betterdesk-${{ matrix.name }}-arm64
platforms: linux/arm64
- name: Export image digest
run: |
set -euo pipefail
digest="${{ steps.build.outputs.digest }}"
test -n "$digest"
mkdir -p "/tmp/digests/${{ matrix.image }}"
touch "/tmp/digests/${{ matrix.image }}/${digest#sha256:}"
- name: Upload image digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.name }}-arm64
path: /tmp/digests/${{ matrix.image }}
if-no-files-found: error
build-aio-arm64:
needs: read-version
if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.tag != 'dev') ||
(github.event_name == 'push' &&
(startsWith(github.event.head_commit.message, 'chore: bump version') ||
startsWith(github.event.head_commit.message, 'chore: release version')) &&
contains(github.event.head_commit.message, '[version-bump]') &&
github.ref != 'refs/heads/dev')
runs-on: ubuntu-24.04-arm
timeout-minutes: 330
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
outputs: type=image,name=${{ env.IMAGE_PREFIX }}/betterdesk,push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.version=${{ needs.read-version.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
build-args: |
BETTERDESK_COMMIT_SHA=${{ github.sha }}
BETTERDESK_IMAGE_VERSION=${{ needs.read-version.outputs.version }}
BETTERDESK_PRODUCT_VERSION=${{ needs.read-version.outputs.version }}
cache-from: type=gha,scope=betterdesk-aio-arm64
cache-to: type=gha,mode=max,scope=betterdesk-aio-arm64
platforms: linux/arm64
- name: Export image digest
run: |
set -euo pipefail
digest="${{ steps.build.outputs.digest }}"
test -n "$digest"
mkdir -p /tmp/digests/betterdesk
touch "/tmp/digests/betterdesk/${digest#sha256:}"
- name: Upload image digest
uses: actions/upload-artifact@v4
with:
name: digests-aio-arm64
path: /tmp/digests/betterdesk
if-no-files-found: error
# No public image tag is written until all required platform digests exist.
merge-images:
needs: [read-version, build-server, build-console, build-allinone, build-arm64, build-aio-arm64]
if: |
always() &&
needs.read-version.result == 'success' &&
needs.build-server.result == 'success' &&
needs.build-console.result == 'success' &&
needs.build-allinone.result == 'success' &&
needs.build-arm64.result == 'success' &&
(needs.build-aio-arm64.result == 'success' ||
(needs.build-aio-arm64.result == 'skipped' &&
((github.event_name == 'push' && github.ref == 'refs/heads/dev') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev'))))
strategy:
fail-fast: false
matrix:
include:
- name: server
image: betterdesk-server
- name: console
image: betterdesk-console
- name: aio
image: betterdesk
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download platform digests
uses: actions/download-artifact@v4
with:
pattern: digests-${{ matrix.name }}-*
path: /tmp/digests
merge-multiple: true
- name: Extract final image metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.IMAGE_PREFIX }}/${{ matrix.image }}
labels: |
org.opencontainers.image.version=${{ needs.read-version.outputs.version }}
tags: |
type=raw,value=latest,enable=${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'release' && github.event.release.prerelease == false) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main') }}
type=raw,value=dev,enable=${{ (github.ref == 'refs/heads/dev' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, '-') && (github.event_name != 'workflow_dispatch' || !contains(github.event.inputs.tag, '-')) }}
type=raw,value=${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=v${{ needs.read-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.tag == '' || github.event.inputs.tag == 'latest') && github.ref == 'refs/heads/main' }}
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' && github.event.inputs.tag != 'latest' && github.event.inputs.tag != 'dev' }}
type=sha,prefix=sha-,enable=${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == 'dev') }}
- name: Create multi-architecture manifest
env:
IMAGE: ${{ env.IMAGE_PREFIX }}/${{ matrix.image }}
TAGS: ${{ steps.meta.outputs.tags }}
run: |
set -euo pipefail
mapfile -t tags < <(printf '%s\n' "$TAGS" | sed '/^[[:space:]]*$/d')
mapfile -t digests < <(find /tmp/digests -maxdepth 1 -type f -printf '%f\n' | sort)
test "${#tags[@]}" -gt 0
test "${#digests[@]}" -gt 0
sources=()
for digest in "${digests[@]}"; do
sources+=("${IMAGE}@sha256:${digest}")
done
tag_args=()
for tag in "${tags[@]}"; do
tag_args+=(-t "$tag")
done
docker buildx imagetools create "${tag_args[@]}" "${sources[@]}"
- name: Resolve server scan reference
if: matrix.name == 'server'
id: scanref
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: |
set -euo pipefail
image="$(printf '%s\n' "$TAGS" | sed '/^[[:space:]]*$/d' | head -n1)"
test -n "$image"
echo "image=$image" >> "$GITHUB_OUTPUT"
- name: Generate server SBOM
if: matrix.name == 'server'
continue-on-error: true
uses: anchore/sbom-action@v0
env:
SYFT_REGISTRY_AUTH_USERNAME: ${{ github.actor }}
SYFT_REGISTRY_AUTH_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
image: ${{ steps.scanref.outputs.image }}
format: spdx-json
output-file: sbom-server.spdx.json
- name: Scan server image
if: matrix.name == 'server'
continue-on-error: true
uses: aquasecurity/trivy-action@0.28.0
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
image-ref: ${{ steps.scanref.outputs.image }}
format: table
exit-code: 0
severity: CRITICAL,HIGH
update-description:
needs: [build-server, build-console, build-allinone]
needs: merge-images
runs-on: ubuntu-latest
if: |
always() &&
needs.build-server.result == 'success' &&
needs.build-console.result == 'success' &&
needs.build-allinone.result == 'success'
needs.merge-images.result == 'success'
permissions:
contents: read
@@ -328,26 +592,19 @@ jobs:
- name: Summary
env:
SERVER_TAGS: ${{ needs.build-server.outputs.tags }}
CONSOLE_TAGS: ${{ needs.build-console.outputs.tags }}
ALLINONE_TAGS: ${{ needs.build-allinone.outputs.tags }}
IMAGE_TAG: ${{ github.event.inputs.tag }}
run: |
extract_tags() {
echo "$1" | sed -n 's/.*:\([^ ]*\)$/\1/p' | sort -u | paste -sd ', ' -
}
server_tags="$(extract_tags "$SERVER_TAGS")"
console_tags="$(extract_tags "$CONSOLE_TAGS")"
allinone_tags="$(extract_tags "$ALLINONE_TAGS")"
pin_ver="$(tr -d '\n\r' < VERSION 2>/dev/null || echo VERSION)"
requested_tag="${IMAGE_TAG:-automatic}"
{
echo "## Docker images published"
echo ""
echo "| Image | Tags |"
echo "|-------|------|"
echo "| \`ghcr.io/${{ github.repository_owner }}/betterdesk-server\` | ${server_tags:-n/a} |"
echo "| \`ghcr.io/${{ github.repository_owner }}/betterdesk-console\` | ${console_tags:-n/a} |"
echo "| \`ghcr.io/${{ github.repository_owner }}/betterdesk\` | ${allinone_tags:-n/a} |"
echo "Requested tag: \`${requested_tag}\`"
echo "Product version: \`${pin_ver}\`"
echo ""
echo "- \`ghcr.io/${{ github.repository_owner }}/betterdesk-server\`"
echo "- \`ghcr.io/${{ github.repository_owner }}/betterdesk-console\`"
echo "- \`ghcr.io/${{ github.repository_owner }}/betterdesk\`"
echo ""
echo "### Pin a version (production — recommended)"
echo "\`\`\`bash"
+2 -1
View File
@@ -101,7 +101,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
node-version: '22.23.2'
cache: npm
cache-dependency-path: web-nodejs/package-lock.json
- name: Install console dependencies
@@ -142,6 +142,7 @@ jobs:
docker-compose.single.yml \
docker-compose.quick.yml \
docker-compose.quick.single.yml \
docker-compose.quick.macvlan.yml \
docker-compose.quick.single.macvlan.yml; do
docker compose -f "$file" config --quiet
done
+21 -8
View File
@@ -166,11 +166,24 @@ jobs:
cat DESKTOP_CHECKSUMS.sha256
- name: Upload desktop artifacts to product release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: false
files: |
betterdesk-windows-x64/*
betterdesk-linux-x64/*
DESKTOP_CHECKSUMS.sha256
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
for attempt in $(seq 1 120); do
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
break
fi
if [ "$attempt" -eq 120 ]; then
echo "GitHub Release $TAG_NAME was not created within 20 minutes" >&2
exit 1
fi
sleep 10
done
gh release upload "$TAG_NAME" \
betterdesk-windows-x64/* \
betterdesk-linux-x64/* \
DESKTOP_CHECKSUMS.sha256 \
--clobber
+27 -13
View File
@@ -133,16 +133,30 @@ jobs:
done
cat SERVER_CHECKSUMS.sha256
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
betterdesk-server-linux-amd64/betterdesk-server-linux-amd64
betterdesk-server-linux-amd64/betterdesk-server-linux-amd64.manifest.json
betterdesk-server-linux-arm64/betterdesk-server-linux-arm64
betterdesk-server-linux-arm64/betterdesk-server-linux-arm64.manifest.json
betterdesk-server-windows-amd64.exe/betterdesk-server-windows-amd64.exe
betterdesk-server-windows-amd64.exe/betterdesk-server-windows-amd64.exe.manifest.json
migrate-linux-amd64/migrate-linux-amd64
SERVER_CHECKSUMS.sha256
- name: Upload server artifacts to GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
for attempt in $(seq 1 120); do
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
break
fi
if [ "$attempt" -eq 120 ]; then
echo "GitHub Release $TAG_NAME was not created within 20 minutes" >&2
exit 1
fi
sleep 10
done
gh release upload "$TAG_NAME" \
betterdesk-server-linux-amd64/betterdesk-server-linux-amd64 \
betterdesk-server-linux-amd64/betterdesk-server-linux-amd64.manifest.json \
betterdesk-server-linux-arm64/betterdesk-server-linux-arm64 \
betterdesk-server-linux-arm64/betterdesk-server-linux-arm64.manifest.json \
betterdesk-server-windows-amd64.exe/betterdesk-server-windows-amd64.exe \
betterdesk-server-windows-amd64.exe/betterdesk-server-windows-amd64.exe.manifest.json \
migrate-linux-amd64/migrate-linux-amd64 \
SERVER_CHECKSUMS.sha256 \
--clobber
+14 -7
View File
@@ -80,15 +80,10 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEW_VERSION: ${{ steps.bump.outputs.version }}
run: |
set -euo pipefail
TAG="v${NEW_VERSION}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag ${TAG} already exists — skipping tag/release creation"
exit 0
fi
git tag "$TAG"
git push origin "$TAG"
NOTES_FILE=$(mktemp)
trap 'rm -f "$NOTES_FILE"' EXIT
awk -v ver="${NEW_VERSION}" '
BEGIN { found=0 }
/^## \[/ {
@@ -102,6 +97,18 @@ jobs:
echo "BetterDesk ${NEW_VERSION} stable release." > "$NOTES_FILE"
fi
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
git tag "$TAG"
git push origin "$TAG"
else
echo "Tag ${TAG} already exists — checking release state"
fi
if gh release view "$TAG" >/dev/null 2>&1; then
echo "GitHub Release ${TAG} already exists"
exit 0
fi
gh release create "$TAG" \
--title "BetterDesk ${NEW_VERSION}" \
--notes-file "$NOTES_FILE"
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '24'
node-version: '22.23.2'
cache: npm
cache-dependency-path: web-nodejs/package-lock.json
+2 -1
View File
@@ -18,6 +18,7 @@
# ============= Stage 1: Build Go server =============
FROM golang:1.26-alpine AS go-builder
ARG TARGETARCH
# Retry apk in case of transient DNS failures (common on AlmaLinux/CentOS Docker)
RUN apk add --no-cache git || { sleep 2 && apk add --no-cache git; }
@@ -30,7 +31,7 @@ COPY betterdesk-server/ .
ARG BETTERDESK_PRODUCT_VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build \
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build \
-ldflags="-s -w -X main.Version=${BETTERDESK_PRODUCT_VERSION}" \
-tags "netgo osusergo" \
-o /betterdesk-server .
+2 -1
View File
@@ -8,6 +8,7 @@
# ---- Build stage ----
FROM golang:1.26-alpine AS builder
ARG TARGETARCH
RUN apk add --no-cache git || { sleep 2 && apk add --no-cache git; }
@@ -24,7 +25,7 @@ COPY betterdesk-server/ .
ARG BETTERDESK_PRODUCT_VERSION=dev
# Build static binary (modernc.org/sqlite is pure Go — no CGO needed)
RUN CGO_ENABLED=0 GOOS=linux go build \
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build \
-ldflags="-s -w -X main.Version=${BETTERDESK_PRODUCT_VERSION}" \
-tags "netgo osusergo" \
-o /betterdesk-server .