From 39d048f5fed34144061201827dfa7a25f26727fe Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 17 Jun 2026 18:30:38 +0300 Subject: [PATCH] Add CI: release the Windows guest exe on v* tags Gitea Actions workflow that cross-compiles vmie-startup.exe (mingw-w64) and publishes a win64 zip (exe + LICENSE) to the tag's release. Builds only the Windows artifact; a .gitignore negation keeps .gitea/ tracked under the .*/ rule. --- .gitea/workflows/release.yml | 72 ++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 73 insertions(+) create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..2742323 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,72 @@ +name: release + +on: + push: + tags: + - 'v*' + +jobs: + windows-exe: + 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 gcc-mingw-w64-x86-64 + + - name: Configure + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + + - name: Build Windows exe + run: cmake --build build -j --target vmie-startup + + - name: Package + env: + TAG: ${{ github.ref_name }} + run: | + set -euo pipefail + mkdir -p dist/vmie-startup + cp build/vmie-startup.exe dist/vmie-startup/ + [ -f LICENSE ] && cp LICENSE dist/vmie-startup/ || true + (cd dist && zip -r "vmie-startup-${TAG}-win64.zip" vmie-startup) + + - 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="vmie-startup-${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}" diff --git a/.gitignore b/.gitignore index 85ad357..d4115e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .*/ +!.gitea/ cmake-*/ compile* \ No newline at end of file