Files
proxy-suite-flake/.gitea/workflows/windows-release.yml
T
faumarayandClaude Opus 5.5 ae58bd1f12 windows: a setup program, and an uninstall entry in Settings > Apps
ProxySuite-<version>-windows-x64-setup.exe (NSIS, English and Russian):
it unpacks the release into its temporary folder and runs the release's
own proxy-suite-service.exe install from there, as install.cmd does from
the zip (unpacked straight into Program Files, an upgrade would find its
files in use). It refuses 32-bit Windows and anything before 10 1903, and
offers Windows' OpenSSH Client, unchecked, for the SSH tunnel.

install now writes the entry in Settings > Apps (uninstall.cmd; quietly,
the service's uninstall), and uninstall removes it, with WinDivert's
driver service when it is the suite's own.

The release workflow publishes the setup beside the zip. The app's
icon and GPUI's manifest share one resource (llvm-rc for both); the
build scripts' clones retry, and are kept for the next build.
Tested under Wine: tools/wine-setup-test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 13:45:09 +03:00

164 lines
6.7 KiB
YAML

name: Windows release
# The Windows port (windows/). On a tag windows-v<version> it builds the setup program and the
# release zip and publishes them as a Gitea release, with the notes in
# windows/release-notes/<version>.md. Run by hand, it only builds: they are the run's artifact.
#
# Two jobs, as upstream's dependency updates: the one that runs fetched code (crates,
# components, wheels, the Nix closure) holds no token that can write. Only the publishing job
# sees RELEASE_TOKEN (write:repository), and it runs nothing it fetched: curl and jq on the
# first job's artifact. Gitea ignores `permissions:`; they are here to say what each job needs.
on:
push:
tags: ["windows-v*"]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 150
env:
# Single-user Nix without a daemon: the job's container has no init to run one, nor
# the namespaces a build sandbox needs. Set for the job, so the installer has it too.
NIX_CONFIG: |
experimental-features = nix-command flakes
sandbox = false
build-users-group =
defaults:
run:
shell: bash
steps:
# Full history: the flake is windows/ inside this repository, fetched by Nix as git.
- name: Check out
uses: https://github.com/actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Check the version
working-directory: windows
run: |
set -euo pipefail
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
[[ "$GITHUB_REF_NAME" == "windows-v$version" ]] ||
{ echo "::error::the tag is $GITHUB_REF_NAME, but windows/Cargo.toml says $version"; exit 1; }
[ -f "release-notes/$version.md" ] ||
{ echo "::error::no windows/release-notes/$version.md"; exit 1; }
fi
echo "Proxy Suite for Windows $version"
# Pinned: this installer checks the hash of the Nix it downloads, and is checked here.
- name: Install Nix
env:
NIX_VERSION: 2.34.9
NIX_INSTALL_SHA256: a03ce2e9eaf4ea1560260b9a93e311dbaf589d28fb5c9318f8d9e768ee6339d8
run: |
set -euo pipefail
# The runner may run as root (no sudo in the image) or as a user with sudo.
as_root() { if [ "$(id -u)" -eq 0 ]; then "$@"; else sudo "$@"; fi; }
if ! command -v xz >/dev/null 2>&1; then
as_root apt-get update -qq
as_root apt-get install -y -qq xz-utils
fi
as_root install -d -m 0755 -o "$(id -u)" -g "$(id -g)" /nix
tmp=$(mktemp -d)
curl -sSfL -o "$tmp/install" "https://releases.nixos.org/nix/nix-$NIX_VERSION/install"
echo "$NIX_INSTALL_SHA256 $tmp/install" | sha256sum -c --quiet
USER=${USER:-$(id -un)} sh "$tmp/install" --no-daemon --no-modify-profile --no-channel-add
echo "$HOME/.nix-profile/bin" >> "$GITHUB_PATH"
- name: Dev shell and Rust toolchain
working-directory: windows
run: nix develop --command rustup toolchain install
# The default members: everything the zip carries, not the app (GPUI) yet.
- name: Test
working-directory: windows
run: nix develop --command cargo test --locked
- name: Package
working-directory: windows
run: nix develop --command tools/package.sh
- name: Collect
working-directory: windows
run: |
set -euo pipefail
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
mkdir -p ../release
for f in "ProxySuite-$version-windows-x64-setup.exe" "ProxySuite-$version-windows-x64.zip"; do
cp "dist/$f" "dist/$f.sha256" ../release/
done
if [ -f "release-notes/$version.md" ]; then cp "release-notes/$version.md" ../release/notes.md; fi
- name: Upload
uses: https://github.com/actions/upload-artifact@v4
with:
name: windows-release
path: release/
if-no-files-found: error
publish:
needs: build
if: startsWith(github.ref, 'refs/tags/windows-v')
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: write
defaults:
run:
shell: bash
steps:
- name: Download
uses: https://github.com/actions/download-artifact@v4
with:
name: windows-release
path: release
# The release for the tag, made if it is not there yet (a pre-release for a version with
# a "-"), and its assets, replacing any of the same name, so a rerun is harmless.
- name: Publish
env:
TOKEN: ${{ secrets.RELEASE_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TAG: ${{ github.ref_name }}
SHA: ${{ github.sha }}
run: |
set -euo pipefail
as_root() { if [ "$(id -u)" -eq 0 ]; then "$@"; else sudo "$@"; fi; }
if ! command -v jq >/dev/null 2>&1; then
as_root apt-get update -qq
as_root apt-get install -y -qq jq
fi
[ -n "$TOKEN" ] || { echo "::error::the RELEASE_TOKEN secret is not set"; exit 1; }
api() { curl -sS --fail-with-body -H "Authorization: token $TOKEN" "$@"; }
version=${TAG#windows-v}
code=$(curl -sS -o found.json -w '%{http_code}' -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG")
case $code in
200) id=$(jq -r .id found.json) ;;
404)
pre=false
[[ "$version" == *-* ]] && pre=true
id=$(jq -n --arg tag "$TAG" --arg sha "$SHA" --arg name "Proxy Suite for Windows $version" \
--rawfile body release/notes.md --argjson pre "$pre" \
'{tag_name: $tag, target_commitish: $sha, name: $name, body: $body, prerelease: $pre, draft: false}' |
api -H 'Content-Type: application/json' --data-binary @- "$API/releases" | jq -r .id)
echo "made the release for $TAG" ;;
*) echo "::error::looking up the release for $TAG: HTTP $code: $(cat found.json)"; exit 1 ;;
esac
for f in release/*.exe release/*.zip release/*.sha256; do
name=$(basename "$f")
for old in $(api "$API/releases/$id/assets" | jq -r --arg n "$name" '.[] | select(.name == $n) | .id'); do
api -X DELETE "$API/releases/$id/assets/$old" >/dev/null
done
api -F "attachment=@$f" "$API/releases/$id/assets?name=$name" >/dev/null
echo "uploaded $name"
done
echo "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$TAG"