Skip to content

Commit 45ad734

Browse files
committed
ci: add fork release workflow for CLI binary and gateway image
1 parent 95c7f91 commit 45ad734

File tree

2 files changed

+145
-9
lines changed

2 files changed

+145
-9
lines changed

.github/workflows/release-fork.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Release Fork
2+
3+
on:
4+
push:
5+
branches: [feat/credential-injection-query-param-basic-auth]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: release-fork-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
build-cli:
21+
name: Build CLI (linux-amd64)
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 30
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install Rust stable
30+
uses: dtolnay/rust-toolchain@stable
31+
32+
- name: Install protoc
33+
uses: arduino/setup-protoc@v3
34+
with:
35+
version: "29.x"
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Cache cargo registry and build
39+
uses: actions/cache@v4
40+
with:
41+
path: |
42+
~/.cargo/registry
43+
~/.cargo/git
44+
target
45+
key: cargo-cli-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
46+
restore-keys: cargo-cli-${{ runner.os }}-
47+
48+
- name: Build openshell CLI (release)
49+
run: cargo build --release -p openshell-cli
50+
51+
- name: Package binary
52+
run: |
53+
mkdir -p dist
54+
cp target/release/openshell dist/
55+
cd dist
56+
tar czf openshell-linux-amd64.tar.gz openshell
57+
sha256sum openshell-linux-amd64.tar.gz > openshell-linux-amd64.tar.gz.sha256
58+
59+
- name: Upload artifact
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: openshell-linux-amd64
63+
path: |
64+
dist/openshell-linux-amd64.tar.gz
65+
dist/openshell-linux-amd64.tar.gz.sha256
66+
67+
build-gateway:
68+
name: Build gateway Docker image
69+
runs-on: ubuntu-latest
70+
timeout-minutes: 45
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
fetch-depth: 0
75+
76+
- name: Set up Docker Buildx
77+
uses: docker/setup-buildx-action@v3
78+
79+
- name: Log in to GHCR
80+
uses: docker/login-action@v3
81+
with:
82+
registry: ghcr.io
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Build and push gateway image
87+
uses: docker/build-push-action@v6
88+
with:
89+
context: .
90+
file: deploy/docker/Dockerfile.images
91+
target: gateway
92+
platforms: linux/amd64
93+
push: true
94+
tags: |
95+
ghcr.io/htekdev/openshell-gateway:latest
96+
ghcr.io/htekdev/openshell-gateway:${{ github.sha }}
97+
cache-from: type=gha
98+
cache-to: type=gha,mode=max
99+
100+
release:
101+
name: Create GitHub Release
102+
needs: [build-cli]
103+
runs-on: ubuntu-latest
104+
timeout-minutes: 5
105+
steps:
106+
- name: Download CLI artifact
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: openshell-linux-amd64
110+
path: dist/
111+
112+
- name: Create or update release
113+
uses: softprops/action-gh-release@v2
114+
with:
115+
tag_name: fork-latest
116+
name: "Fork Release (credential injection)"
117+
body: |
118+
Pre-built OpenShell fork with L7 credential injection including
119+
query-param rewriting and Basic auth encoding.
120+
121+
Branch: `feat/credential-injection-query-param-basic-auth`
122+
Commit: ${{ github.sha }}
123+
124+
**Changes:** Extends the L7 proxy to inject API credentials at the
125+
network layer for arbitrary REST endpoints, with support for query
126+
parameter injection and HTTP Basic authentication encoding.
127+
128+
**Gateway image:** `ghcr.io/htekdev/openshell-gateway:latest`
129+
draft: false
130+
prerelease: true
131+
make_latest: false
132+
files: |
133+
dist/openshell-linux-amd64.tar.gz
134+
dist/openshell-linux-amd64.tar.gz.sha256
135+
env:
136+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

crates/openshell-core/build.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
}
1818

1919
// --- Protobuf compilation ---
20-
// Use bundled protoc from protobuf-src. The system protoc (from apt-get)
21-
// does not bundle the well-known type includes (google/protobuf/struct.proto
22-
// etc.), so we must use protobuf-src which ships both the binary and the
23-
// include tree.
24-
// SAFETY: This is run at build time in a single-threaded build script context.
25-
// No other threads are reading environment variables concurrently.
26-
#[allow(unsafe_code)]
27-
unsafe {
28-
env::set_var("PROTOC", protobuf_src::protoc());
20+
// Prefer PROTOC env var (e.g., from mise, setup-protoc action, or system
21+
// install) when available. Fall back to bundled protoc from protobuf-src.
22+
if env::var("PROTOC").is_err() {
23+
// SAFETY: This is run at build time in a single-threaded build script context.
24+
// No other threads are reading environment variables concurrently.
25+
#[allow(unsafe_code)]
26+
unsafe {
27+
env::set_var("PROTOC", protobuf_src::protoc());
28+
}
2929
}
3030

3131
let proto_files = [

0 commit comments

Comments
 (0)