forked from LiamAEdwards/SS14-Docker-Linux-Server
Some checks failed
Build and publish wylab SS14 server / build-and-push-image (push) Has been cancelled
83 lines
2.6 KiB
YAML
83 lines
2.6 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
|
|
TARGET_PLATFORM: linux-x64
|
|
WYLAB_SOURCE_REPO: https://git.wylab.me/wylab/wylab-station-14.git
|
|
WYLAB_SOURCE_REF: master
|
|
BUILD_CACHE_SCOPE: ws14-docker-linux-server
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 240
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
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 QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
with:
|
|
platforms: amd64
|
|
|
|
- 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
|
|
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 }}
|
|
build-args: |
|
|
SOURCE_REPO=${{ env.WYLAB_SOURCE_REPO }}
|
|
SOURCE_REF=${{ steps.wylab.outputs.commit }}
|
|
TARGET_PLATFORM=${{ env.TARGET_PLATFORM }}
|