Skip to content

Commit af49f5a

Browse files
committed
build: improve release package contents
1 parent 30c8cc4 commit af49f5a

2 files changed

Lines changed: 89 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,55 @@ jobs:
2727
id: get_tag
2828
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
2929

30-
- name: Build macOS and Windows binaries
30+
- name: Build binaries
3131
run: |
3232
# 创建build目录存放二进制文件
3333
mkdir -p builds
3434
3535
# linux (amd64)
36-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o builds/tiny-requestbin-${{ env.TAG }}-linux-amd64 .
36+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o builds/tiny-requestbin-linux-amd64 .
3737
3838
# Linux (arm64)
39-
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o builds/tiny-requestbin-${{ env.TAG }}-linux-arm64 .
39+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags '-extldflags "-static"' -o builds/tiny-requestbin-linux-arm64 .
4040
4141
# macOS (Intel)
42-
GOOS=darwin GOARCH=amd64 go build -o builds/tiny-requestbin-${{ env.TAG }}-darwin-amd64 .
42+
GOOS=darwin GOARCH=amd64 go build -o builds/tiny-requestbin-darwin-amd64 .
4343
4444
# macOS (Apple Silicon)
45-
GOOS=darwin GOARCH=arm64 go build -o builds/tiny-requestbin-${{ env.TAG }}-darwin-arm64 .
45+
GOOS=darwin GOARCH=arm64 go build -o builds/tiny-requestbin-darwin-arm64 .
4646
4747
# Windows (x86_64)
48-
GOOS=windows GOARCH=amd64 go build -o builds/tiny-requestbin-${{ env.TAG }}-windows-amd64.exe .
48+
GOOS=windows GOARCH=amd64 go build -o builds/tiny-requestbin-windows-amd64.exe .
4949
5050
- name: Compress Binaries
5151
run: |
52-
# 创建压缩文件
5352
cd builds
53+
mkdir -p packages
5454
55-
# 压缩Linux二进制文件
55+
make_package_dir() {
56+
local package_name="$1"
57+
local binary_source="$2"
58+
local binary_name="$3"
5659
57-
tar -czf tiny-requestbin-${{ env.TAG }}-linux-amd64.tar.gz tiny-requestbin-${{ env.TAG }}-linux-amd64
58-
tar -czf tiny-requestbin-${{ env.TAG }}-linux-arm64.tar.gz tiny-requestbin-${{ env.TAG }}-linux-arm64
60+
mkdir -p "packages/${package_name}"
61+
cp "${binary_source}" "packages/${package_name}/${binary_name}"
62+
cp ../LICENSE "packages/${package_name}/LICENSE"
63+
cp ../packaging/release-package-readme.txt "packages/${package_name}/README.txt"
64+
}
5965
60-
# 压缩Mac二进制文件
61-
tar -czf tiny-requestbin-${{ env.TAG }}-darwin-amd64.tar.gz tiny-requestbin-${{ env.TAG }}-darwin-amd64
62-
tar -czf tiny-requestbin-${{ env.TAG }}-darwin-arm64.tar.gz tiny-requestbin-${{ env.TAG }}-darwin-arm64
63-
64-
# 压缩Windows二进制文件
65-
zip tiny-requestbin-${{ env.TAG }}-windows-amd64.zip tiny-requestbin-${{ env.TAG }}-windows-amd64.exe
66+
make_package_dir "tiny-requestbin-${TAG}-linux-amd64" "tiny-requestbin-linux-amd64" "tiny-requestbin"
67+
make_package_dir "tiny-requestbin-${TAG}-linux-arm64" "tiny-requestbin-linux-arm64" "tiny-requestbin"
68+
make_package_dir "tiny-requestbin-${TAG}-darwin-amd64" "tiny-requestbin-darwin-amd64" "tiny-requestbin"
69+
make_package_dir "tiny-requestbin-${TAG}-darwin-arm64" "tiny-requestbin-darwin-arm64" "tiny-requestbin"
70+
make_package_dir "tiny-requestbin-${TAG}-windows-amd64" "tiny-requestbin-windows-amd64.exe" "tiny-requestbin.exe"
71+
72+
tar -czf "tiny-requestbin-${TAG}-linux-amd64.tar.gz" -C packages "tiny-requestbin-${TAG}-linux-amd64"
73+
tar -czf "tiny-requestbin-${TAG}-linux-arm64.tar.gz" -C packages "tiny-requestbin-${TAG}-linux-arm64"
74+
75+
tar -czf "tiny-requestbin-${TAG}-darwin-amd64.tar.gz" -C packages "tiny-requestbin-${TAG}-darwin-amd64"
76+
tar -czf "tiny-requestbin-${TAG}-darwin-arm64.tar.gz" -C packages "tiny-requestbin-${TAG}-darwin-arm64"
77+
78+
(cd packages && zip -rq "../tiny-requestbin-${TAG}-windows-amd64.zip" "tiny-requestbin-${TAG}-windows-amd64")
6679
6780
- name: Create Release
6881
id: create_release
@@ -119,4 +132,4 @@ jobs:
119132
tags: ${{ steps.meta.outputs.tags }}
120133
labels: ${{ steps.meta.outputs.labels }}
121134
cache-from: type=gha
122-
cache-to: type=gha,mode=max
135+
cache-to: type=gha,mode=max
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Tiny RequestBin
2+
================
3+
4+
Tiny RequestBin is a lightweight HTTP request inspector written in Go.
5+
6+
Quick start
7+
-----------
8+
9+
1. Extract this archive.
10+
2. Open a terminal in the extracted directory.
11+
3. Run the binary:
12+
13+
macOS / Linux:
14+
./tiny-requestbin
15+
16+
Windows:
17+
tiny-requestbin.exe
18+
19+
4. Open the web UI:
20+
21+
http://127.0.0.1:8282/
22+
23+
HTTPS example
24+
-------------
25+
26+
If you already have a local certificate and key, you can start with HTTPS:
27+
28+
tiny-requestbin -port 9443 -listen 127.0.0.1 -tls-cert ./localhost.pem -tls-key ./localhost-key.pem
29+
30+
CLI mode
31+
--------
32+
33+
To also print captured requests in the terminal:
34+
35+
tiny-requestbin -cli
36+
37+
Useful flags
38+
------------
39+
40+
-port Port to listen on. Default: 8282
41+
-listen Address to listen on. Default: 127.0.0.1
42+
-max Maximum number of requests to store. Default: 100
43+
-cli Print captured requests to the terminal
44+
-tls-cert TLS certificate file
45+
-tls-key TLS private key file
46+
47+
macOS note
48+
----------
49+
50+
If macOS blocks the downloaded binary on first launch, run:
51+
52+
chmod +x tiny-requestbin
53+
xattr -d com.apple.quarantine tiny-requestbin
54+
55+
Project page
56+
------------
57+
58+
GitHub:
59+
https://github.com/knktc/tiny-requestbin

0 commit comments

Comments
 (0)