mirror of
https://dev.lirent.ru/Vatrog/vm-automation-signaling.git
synced 2026-06-25 20:36:36 +03:00
bd8b966017
- src/si/vgpu-stream: in-guest vgpu producer built as a Windows cross-compiled target (if(WIN32)) - .gitea: release workflow — cross-build the agent and build/publish the deb against system vmie - cmake/makefile: resolve vmie from a source tree (LIBVMIE_PATH) or installed libvmie-dev
124 lines
4.4 KiB
YAML
124 lines
4.4 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
# No deployment-specific values are hardcoded: server/owner/repo come from the CI context,
|
|
# the publish token from a secret. Mirrors the sibling vmie release pipeline.
|
|
jobs:
|
|
# In-guest vgpu producer (Windows, cross-compiled) -> attached to the release.
|
|
windows-agent:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:20-bookworm-slim
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install toolchain
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
cmake make zip jq curl ca-certificates gcc-mingw-w64-x86-64
|
|
|
|
- name: Cross-build the agent
|
|
run: |
|
|
cmake -S . -B build-win -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-w64.cmake
|
|
cmake --build build-win -j
|
|
|
|
- name: Package
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p dist/vgpu-streamer
|
|
cp build-win/vgpu-streamer.exe dist/vgpu-streamer/
|
|
[ -f LICENSE ] && cp LICENSE dist/vgpu-streamer/ || true
|
|
(cd dist && zip -r "vgpu-streamer-${TAG}-win64.zip" vgpu-streamer)
|
|
|
|
- name: Attach to release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
|
SERVER: ${{ github.server_url }}
|
|
REPO: ${{ github.repository }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
set -euo pipefail
|
|
asset="vgpu-streamer-${TAG}-win64.zip"
|
|
api="${SERVER}/api/v1/repos/${REPO}"
|
|
auth="Authorization: token ${GITEA_TOKEN}"
|
|
|
|
rid=$(curl -sSL -H "$auth" "${api}/releases/tags/${TAG}" | jq -r '.id // empty' || true)
|
|
if [ -z "$rid" ]; then
|
|
rid=$(curl -fsSL -X POST -H "$auth" -H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}" \
|
|
"${api}/releases" | jq -r '.id')
|
|
fi
|
|
curl -fsSL -H "$auth" "${api}/releases/${rid}/assets" \
|
|
| jq -r ".[] | select(.name==\"${asset}\") | .id" \
|
|
| while read -r aid; do
|
|
[ -n "$aid" ] && curl -fsSL -X DELETE -H "$auth" "${api}/releases/${rid}/assets/${aid}"
|
|
done
|
|
curl -fsSL -X POST -H "$auth" \
|
|
-F "attachment=@dist/${asset};type=application/zip" \
|
|
"${api}/releases/${rid}/assets?name=${asset}"
|
|
|
|
# Host package (daemon + libs) -> the Gitea Debian registry. Built against the published
|
|
# vmie dev package (external dependency), installed from the same registry.
|
|
deb:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:20-bookworm-slim
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install toolchain + vmie (external dependency)
|
|
env:
|
|
SERVER: ${{ github.server_url }}
|
|
OWNER: ${{ github.repository_owner }}
|
|
run: |
|
|
set -euo pipefail
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
cmake make gcc libc6-dev dpkg-dev file ca-certificates curl
|
|
echo "deb [trusted=yes] ${SERVER}/api/packages/${OWNER}/debian stable main" \
|
|
> /etc/apt/sources.list.d/gitea.list
|
|
apt-get update
|
|
apt-get install -y libvmie-dev
|
|
|
|
- name: Build package
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: make deb VERSION="${TAG#v}"
|
|
|
|
- name: Publish to Debian registry
|
|
env:
|
|
TOKEN: ${{ secrets.PUBLISH_TOKEN }} # requires scope: package:write
|
|
SERVER: ${{ github.server_url }}
|
|
OWNER: ${{ github.repository_owner }}
|
|
DISTRIBUTION: stable
|
|
COMPONENT: main
|
|
run: |
|
|
set -euo pipefail
|
|
url="${SERVER}/api/packages/${OWNER}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload"
|
|
auth="Authorization: token ${TOKEN}"
|
|
for deb in dist/*.deb; do
|
|
# 201 Created = uploaded; 409 Conflict = this version already present (re-run).
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' -X PUT -H "$auth" -T "$deb" "$url")
|
|
echo "$deb -> HTTP $code"
|
|
if [ "$code" != 201 ] && [ "$code" != 409 ]; then
|
|
echo "upload failed: $deb (HTTP $code)" >&2
|
|
exit 1
|
|
fi
|
|
done
|