mirror of
https://dev.lirent.ru/Vatrog/vm-vgpu-streamer.git
synced 2026-06-18 00:06:36 +03:00
ci: release windows exe to gitea release on v* tags
- .gitea/workflows/release.yml: mingw-w64 cross-compile in container, package exe+LICENSE, publish to the tag release via Gitea API - LICENSE: MIT - .gitignore: un-ignore .gitea/
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
windows-exe:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:20-bookworm-slim
|
||||
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: Configure
|
||||
run: >
|
||||
cmake -S . -B build
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-w64.cmake
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Package
|
||||
env:
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p dist/vgpu-streamer
|
||||
cp build/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: Publish 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}"
|
||||
|
||||
# find the release for this tag, or create it
|
||||
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
|
||||
|
||||
# drop a prior asset of the same name so re-runs are idempotent
|
||||
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}"
|
||||
@@ -1,4 +1,5 @@
|
||||
.*/
|
||||
!.gitea/
|
||||
cmake-*/
|
||||
compile*
|
||||
docs/plans/
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024-2026 Gregory Lirent <opensource@lirent.ru>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Reference in New Issue
Block a user