Skip to content

Commit 5f2d01e

Browse files
release(webprox): prepare v0.1.1
1 parent f5ba056 commit 5f2d01e

6 files changed

Lines changed: 280 additions & 2 deletions

File tree

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
name: Release 19_webprox
2+
3+
on:
4+
push:
5+
tags:
6+
- 'webprox-v*'
7+
paths:
8+
- 'examples/19_webprox/**'
9+
- '.github/workflows/release-19-webprox.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
detect-changes:
14+
name: Detect 19_webprox Changes
15+
runs-on: ubuntu-latest
16+
outputs:
17+
should_build: ${{ steps.detect.outputs.should_build }}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 2
23+
24+
- name: Decide whether to build
25+
id: detect
26+
shell: bash
27+
run: |
28+
set -euo pipefail
29+
30+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
31+
echo "Manual run requested; enabling build."
32+
echo "should_build=true" >> "$GITHUB_OUTPUT"
33+
exit 0
34+
fi
35+
36+
if git rev-parse "${GITHUB_SHA}^" >/dev/null 2>&1; then
37+
changed_files="$(git diff --name-only "${GITHUB_SHA}^" "${GITHUB_SHA}")"
38+
else
39+
changed_files="$(git show --pretty='' --name-only "${GITHUB_SHA}")"
40+
fi
41+
42+
echo "Changed files in tagged commit:"
43+
echo "$changed_files"
44+
45+
if echo "$changed_files" | grep -Eq '^(examples/19_webprox/|\.github/workflows/release-19-webprox\.yml$)'; then
46+
echo "should_build=true" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "should_build=false" >> "$GITHUB_OUTPUT"
49+
fi
50+
51+
validate-versions:
52+
name: Validate Tag vs Crate Versions
53+
needs: detect-changes
54+
if: needs.detect-changes.outputs.should_build == 'true'
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
60+
- name: Validate versions
61+
shell: bash
62+
run: |
63+
set -euo pipefail
64+
65+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
66+
echo "Manual run requested; skipping tag/version validation."
67+
exit 0
68+
fi
69+
70+
tag="${GITHUB_REF_NAME}"
71+
if [[ ! "$tag" =~ ^webprox-v(.+)$ ]]; then
72+
echo "Tag '$tag' does not match required format 'webprox-v<version>'." >&2
73+
exit 1
74+
fi
75+
tag_version="${BASH_REMATCH[1]}"
76+
77+
server_version="$(sed -n 's/^version = \"\\([^\"]*\\)\"/\\1/p' examples/19_webprox/cloud-proxy-server/Cargo.toml | head -n1)"
78+
client_version="$(sed -n 's/^version = \"\\([^\"]*\\)\"/\\1/p' examples/19_webprox/minimal-tui-client/Cargo.toml | head -n1)"
79+
80+
if [ -z "$server_version" ] || [ -z "$client_version" ]; then
81+
echo "Failed to read crate version(s) from Cargo.toml." >&2
82+
exit 1
83+
fi
84+
85+
echo "Tag version: $tag_version"
86+
echo "cloud-proxy-server version: $server_version"
87+
echo "minimal-tui-client version: $client_version"
88+
89+
if [ "$tag_version" != "$server_version" ]; then
90+
echo "Tag version does not match cloud-proxy-server version." >&2
91+
exit 1
92+
fi
93+
94+
if [ "$tag_version" != "$client_version" ]; then
95+
echo "Tag version does not match minimal-tui-client version." >&2
96+
exit 1
97+
fi
98+
99+
build-and-release:
100+
name: Build and Release
101+
needs: [detect-changes, validate-versions]
102+
if: needs.detect-changes.outputs.should_build == 'true'
103+
runs-on: ${{ matrix.os }}
104+
permissions:
105+
contents: write
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
include:
110+
- os: ubuntu-latest
111+
target: x86_64-unknown-linux-gnu
112+
asset_name: webprox-linux-amd64
113+
archive_ext: tar.gz
114+
- os: macos-latest
115+
target: x86_64-apple-darwin
116+
asset_name: webprox-macos-amd64
117+
archive_ext: tar.gz
118+
- os: macos-latest
119+
target: aarch64-apple-darwin
120+
asset_name: webprox-macos-arm64
121+
archive_ext: tar.gz
122+
- os: windows-latest
123+
target: x86_64-pc-windows-msvc
124+
asset_name: webprox-windows-amd64
125+
archive_ext: zip
126+
127+
steps:
128+
- name: Checkout code
129+
uses: actions/checkout@v4
130+
131+
- name: Install Rust
132+
uses: dtolnay/rust-toolchain@stable
133+
with:
134+
targets: ${{ matrix.target }}
135+
136+
- name: Rust Cache
137+
uses: Swatinem/rust-cache@v2
138+
with:
139+
workspaces: |
140+
examples/19_webprox
141+
142+
- name: Build workspace in release mode
143+
run: cargo build --manifest-path examples/19_webprox/Cargo.toml --workspace --release --target ${{ matrix.target }}
144+
145+
- name: Create archive (Unix)
146+
if: runner.os != 'Windows'
147+
shell: bash
148+
run: |
149+
set -euo pipefail
150+
151+
BIN_DIR="examples/19_webprox/target/${{ matrix.target }}/release"
152+
ASSET="${{ matrix.asset_name }}.${{ matrix.archive_ext }}"
153+
154+
bins=()
155+
for bin in cloud-proxy-server minimal-tui-client; do
156+
if [ -f "$BIN_DIR/$bin" ]; then
157+
bins+=("$bin")
158+
fi
159+
done
160+
161+
if [ "${#bins[@]}" -eq 0 ]; then
162+
echo "No binaries found in $BIN_DIR" >&2
163+
exit 1
164+
fi
165+
166+
tar czf "$ASSET" -C "$BIN_DIR" "${bins[@]}"
167+
168+
- name: Create archive (Windows)
169+
if: runner.os == 'Windows'
170+
shell: pwsh
171+
run: |
172+
$binDir = "examples/19_webprox/target/${{ matrix.target }}/release"
173+
$asset = "${{ matrix.asset_name }}.${{ matrix.archive_ext }}"
174+
175+
$candidates = @("cloud-proxy-server.exe", "minimal-tui-client.exe")
176+
$files = @()
177+
foreach ($candidate in $candidates) {
178+
$path = Join-Path $binDir $candidate
179+
if (Test-Path $path) {
180+
$files += $path
181+
}
182+
}
183+
184+
if ($files.Count -eq 0) {
185+
Write-Error "No binaries found in $binDir"
186+
}
187+
188+
Compress-Archive -Path $files -DestinationPath $asset -Force
189+
190+
- name: Upload assets to release
191+
uses: softprops/action-gh-release@v2
192+
with:
193+
files: |
194+
${{ matrix.asset_name }}.${{ matrix.archive_ext }}
195+
env:
196+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

examples/19_webprox/cloud-proxy-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cloud-proxy-server"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55

66
[lib]

examples/19_webprox/cloud-proxy-server/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use clap::Parser;
88
#[derive(Parser, Debug)]
99
#[command(name = "cloud-proxy-server")]
1010
#[command(about = "Remote browser proxy server", long_about = None)]
11+
#[command(version)]
1112
struct Args {
1213
/// Disable headless mode (show browser window)
1314
#[arg(long, default_value_t = false)]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# 19_webprox Release Process
2+
3+
This project is released from the monorepo root via:
4+
5+
- `.github/workflows/release-19-webprox.yml`
6+
7+
The workflow builds and publishes release artifacts for:
8+
9+
- Linux (`x86_64-unknown-linux-gnu`)
10+
- macOS Intel (`x86_64-apple-darwin`)
11+
- macOS Apple Silicon (`aarch64-apple-darwin`)
12+
- Windows (`x86_64-pc-windows-msvc`)
13+
14+
Published artifacts include only these binaries:
15+
16+
- `cloud-proxy-server`
17+
- `minimal-tui-client`
18+
19+
`chrome-test` is not published as a release artifact.
20+
21+
## Trigger Rules
22+
23+
Releases are triggered by pushing a tag matching:
24+
25+
- `webprox-v*` (example: `webprox-v0.1.0`)
26+
27+
For tag-triggered releases, the workflow enforces version consistency:
28+
29+
- tag `webprox-vX.Y.Z` must match `version = "X.Y.Z"` in:
30+
- `examples/19_webprox/cloud-proxy-server/Cargo.toml`
31+
- `examples/19_webprox/minimal-tui-client/Cargo.toml`
32+
33+
If either version does not match the tag, the workflow fails before building.
34+
35+
The workflow is path-gated for the `19_webprox` subproject and only proceeds with build/release when relevant files changed in the tagged commit:
36+
37+
- `examples/19_webprox/**`
38+
- `.github/workflows/release-19-webprox.yml`
39+
40+
A manual run is also possible with `workflow_dispatch`.
41+
42+
## Step-by-Step
43+
44+
1. Prepare your changes in `examples/19_webprox`.
45+
2. Commit and push to your branch/main.
46+
3. Create and push a release tag:
47+
48+
```bash
49+
git tag webprox-v0.1.0
50+
git push origin webprox-v0.1.0
51+
```
52+
53+
4. Verify in GitHub:
54+
- Open **Actions** and find `Release 19_webprox`.
55+
- Confirm all matrix builds pass.
56+
57+
5. Download artifacts:
58+
- Open **Releases** and download archives for your target OS.
59+
60+
## Local Release Build (Current Host)
61+
62+
To produce local release binaries:
63+
64+
```bash
65+
cargo build --manifest-path examples/19_webprox/Cargo.toml --workspace --release
66+
```
67+
68+
Expected binary outputs are under:
69+
70+
- `examples/19_webprox/target/release/`
71+
72+
Primary binaries:
73+
74+
- `cloud-proxy-server`
75+
- `minimal-tui-client`
76+
77+
## Notes
78+
79+
- The workflow file is stored at monorepo root, not inside `examples/19_webprox`.
80+
- Tag naming is specific to this subproject: `webprox-v*`.

examples/19_webprox/minimal-tui-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "minimal-tui-client"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55

66
[[bin]]

examples/19_webprox/minimal-tui-client/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use std::time::Duration;
2525
#[derive(Parser, Debug)]
2626
#[command(name = "minimal-tui-client")]
2727
#[command(about = "Remote browser TUI client", long_about = None)]
28+
#[command(version)]
2829
struct Args {
2930
/// Server address
3031
#[arg(short, long, default_value = "http://[::1]:50051")]

0 commit comments

Comments
 (0)