Files
WS14-Docker-Linux-Server/.github/workflows/main.yml
Codex Agent 7010841d75
Some checks failed
Build and publish wylab SS14 server / build-amd64 (push) Failing after 8s
Build and publish wylab SS14 server / build-arm64 (push) Successful in 12s
Point runners to macos-arm64 and linux-amd64 labels
2025-12-15 01:32:54 +01:00

145 lines
5.0 KiB
YAML

#
name: Build and publish wylab SS14 server
# Build whenever the Docker wrapper changes.
on:
push:
branches: ['main']
repository_dispatch:
types: ['ss14-package-ready']
workflow_dispatch:
# Workflow-wide defaults. Adjust IMAGE_NAME/REGISTRY if you are publishing elsewhere.
env:
REGISTRY: git.wylab.me
IMAGE_NAME: wylab/ws14-docker-linux-server
WYLAB_SOURCE_REPO: https://git.wylab.me/wylab/wylab-station-14.git
WYLAB_SOURCE_REF: master
BUILDKIT_PROGRESS: plain
jobs:
build-arm64:
# Requires a self-hosted macOS arm64 runner
runs-on: [self-hosted, macos-arm64]
timeout-minutes: 240
permissions:
contents: read
packages: write
env:
TARGET_PLATFORM: linux-arm64
BUILD_CACHE_SCOPE: ws14-docker-linux-server-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve wylab commit
id: wylab
env:
PAYLOAD_COMMIT: ${{ github.event.client_payload.commit }}
run: |
set -euo pipefail
if [ -n "${PAYLOAD_COMMIT}" ]; then
COMMIT="${PAYLOAD_COMMIT}"
else
REF="${WYLAB_SOURCE_REF}"
COMMIT=$(git ls-remote "${WYLAB_SOURCE_REPO}" "${REF}" | head -n1 | cut -f1)
fi
if [ -z "${COMMIT}" ]; then
echo "Unable to resolve commit to build." >&2
exit 1
fi
echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME || github.actor }}
password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push Docker image (arm64)
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
platforms: linux/arm64
cache-from: |
type=gha,scope=${{ env.BUILD_CACHE_SCOPE }}
cache-to: |
type=gha,scope=${{ env.BUILD_CACHE_SCOPE }},mode=max,compression=zstd
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:arm64
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.wylab.outputs.commit }}-arm64
build-args: |
SOURCE_REPO=${{ env.WYLAB_SOURCE_REPO }}
SOURCE_REF=${{ steps.wylab.outputs.commit }}
TARGET_PLATFORM=${{ env.TARGET_PLATFORM }}
build-amd64:
# Requires a self-hosted Linux amd64 runner
runs-on: [self-hosted, linux-amd64]
timeout-minutes: 240
permissions:
contents: read
packages: write
env:
TARGET_PLATFORM: linux-x64
BUILD_CACHE_SCOPE: ws14-docker-linux-server-amd64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve wylab commit
id: wylab
env:
PAYLOAD_COMMIT: ${{ github.event.client_payload.commit }}
run: |
set -euo pipefail
if [ -n "${PAYLOAD_COMMIT}" ]; then
COMMIT="${PAYLOAD_COMMIT}"
else
REF="${WYLAB_SOURCE_REF}"
COMMIT=$(git ls-remote "${WYLAB_SOURCE_REPO}" "${REF}" | head -n1 | cut -f1)
fi
if [ -z "${COMMIT}" ]; then
echo "Unable to resolve commit to build." >&2
exit 1
fi
echo "commit=${COMMIT}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME || github.actor }}
password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push Docker image (amd64)
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
platforms: linux/amd64
cache-from: |
type=gha,scope=${{ env.BUILD_CACHE_SCOPE }}
cache-to: |
type=gha,scope=${{ env.BUILD_CACHE_SCOPE }},mode=max,compression=zstd
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.wylab.outputs.commit }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:amd64
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.wylab.outputs.commit }}-amd64
build-args: |
SOURCE_REPO=${{ env.WYLAB_SOURCE_REPO }}
SOURCE_REF=${{ steps.wylab.outputs.commit }}
TARGET_PLATFORM=${{ env.TARGET_PLATFORM }}