Skip to content

Commit 131da18

Browse files
committed
2 parents f7c6264 + 345f28d commit 131da18

34 files changed

Lines changed: 415 additions & 88 deletions
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: "Publish To AUR"
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: "Package version to publish (e.g. 2.0.2). Leave empty to use the latest release tag."
11+
required: false
12+
type: string
13+
14+
jobs:
15+
publish-to-aur:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
steps:
20+
- name: "Checkout"
21+
uses: actions/checkout@v4.1.7
22+
23+
# ── Resolve version ──────────────────────────────────────────────────────
24+
- name: "Resolve version"
25+
id: version
26+
run: |
27+
if [[ -n "${{ inputs.version }}" ]]; then
28+
VERSION="${{ inputs.version }}"
29+
else
30+
# Strip leading 'v' from the release tag (e.g. v2.0.2 → 2.0.2)
31+
VERSION="${GITHUB_REF_NAME#v}"
32+
fi
33+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
34+
echo "Resolved version: ${VERSION}"
35+
36+
# ── Download release assets and compute SHA256 checksums ─────────────────
37+
- name: "Download Linux x86_64 tar.gz and compute SHA256"
38+
id: sha256_x86_64
39+
run: |
40+
VERSION="${{ steps.version.outputs.version }}"
41+
URL="https://github.com/docmirror/dev-sidecar/releases/download/v${VERSION}/DevSidecar-${VERSION}-linux-x86_64.tar.gz"
42+
echo "Downloading: ${URL}"
43+
curl -fsSL -o /tmp/dev-sidecar-x86_64.tar.gz "${URL}"
44+
SHA256=$(sha256sum /tmp/dev-sidecar-x86_64.tar.gz | awk '{print $1}')
45+
echo "sha256=${SHA256}" >> "$GITHUB_OUTPUT"
46+
echo "x86_64 SHA256: ${SHA256}"
47+
48+
- name: "Download Linux aarch64 tar.gz and compute SHA256"
49+
id: sha256_aarch64
50+
run: |
51+
VERSION="${{ steps.version.outputs.version }}"
52+
URL="https://github.com/docmirror/dev-sidecar/releases/download/v${VERSION}/DevSidecar-${VERSION}-linux-arm64.tar.gz"
53+
echo "Downloading: ${URL}"
54+
curl -fsSL -o /tmp/dev-sidecar-aarch64.tar.gz "${URL}"
55+
SHA256=$(sha256sum /tmp/dev-sidecar-aarch64.tar.gz | awk '{print $1}')
56+
echo "sha256=${SHA256}" >> "$GITHUB_OUTPUT"
57+
echo "aarch64 SHA256: ${SHA256}"
58+
59+
# ── Update PKGBUILD ───────────────────────────────────────────────────────
60+
- name: "Update PKGBUILD with new version and checksums"
61+
run: |
62+
VERSION="${{ steps.version.outputs.version }}"
63+
SHA256_X86_64="${{ steps.sha256_x86_64.outputs.sha256 }}"
64+
SHA256_AARCH64="${{ steps.sha256_aarch64.outputs.sha256 }}"
65+
66+
PKGBUILD="packages/aur/PKGBUILD"
67+
68+
# Update pkgver
69+
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "${PKGBUILD}"
70+
71+
# Reset pkgrel to 1 on every new upstream version
72+
sed -i "s/^pkgrel=.*/pkgrel=1/" "${PKGBUILD}"
73+
74+
# Update checksums
75+
sed -i "s/^sha256sums_x86_64=.*/sha256sums_x86_64=('${SHA256_X86_64}')/" "${PKGBUILD}"
76+
sed -i "s/^sha256sums_aarch64=.*/sha256sums_aarch64=('${SHA256_AARCH64}')/" "${PKGBUILD}"
77+
78+
echo "======== Updated PKGBUILD ========"
79+
cat "${PKGBUILD}"
80+
81+
# ── Push to AUR via git + SSH ─────────────────────────────────────────────
82+
- name: "Set up SSH key for AUR"
83+
run: |
84+
install -dm700 ~/.ssh
85+
86+
# Write the private key
87+
echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/aur_id
88+
chmod 600 ~/.ssh/aur_id
89+
90+
# Trust AUR's host key
91+
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
92+
chmod 644 ~/.ssh/known_hosts
93+
94+
# SSH config: use this key for AUR (printf avoids heredoc indentation issues)
95+
printf 'Host aur.archlinux.org\n IdentityFile ~/.ssh/aur_id\n User aur\n' >> ~/.ssh/config
96+
chmod 600 ~/.ssh/config
97+
98+
- name: "Clone AUR repository"
99+
run: |
100+
git clone ssh://aur@aur.archlinux.org/dev-sidecar-bin.git /tmp/aur-dev-sidecar-bin
101+
102+
- name: "Copy PKGBUILD and generate .SRCINFO"
103+
run: |
104+
cp packages/aur/PKGBUILD /tmp/aur-dev-sidecar-bin/PKGBUILD
105+
106+
# Generate .SRCINFO via helper script (makepkg is not available on the ubuntu
107+
# runner since pacman is not installed)
108+
cd /tmp/aur-dev-sidecar-bin
109+
python3 "$GITHUB_WORKSPACE/packages/aur/gen_srcinfo.py"
110+
111+
- name: "Commit and push to AUR"
112+
run: |
113+
cd /tmp/aur-dev-sidecar-bin
114+
115+
git config user.name "${{ vars.AUR_USERNAME }}"
116+
git config user.email "${{ vars.AUR_EMAIL }}"
117+
118+
git add PKGBUILD .SRCINFO
119+
120+
# Only commit if there are actual changes
121+
if git diff --cached --quiet; then
122+
echo "No changes to commit – AUR is already up to date."
123+
else
124+
git commit -m "Update to v${{ steps.version.outputs.version }}"
125+
git push
126+
echo "Successfully pushed to AUR."
127+
fi

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
开发者边车,命名取自service-mesh的service-sidecar,意为为开发者打辅助的边车工具(以下简称ds)
44
通过本地代理的方式将https请求代理到一些国内的加速通道上
55

6-
<a href='https://github.com/docmirror/dev-sidecar'><img alt="GitHub stars" src="https://img.shields.io/github/stars/docmirror/dev-sidecar?logo=github"></a>
6+
<a href='https://github.com/docmirror/dev-sidecar'><img alt="GitHub stars" src="https://img.shields.io/github/stars/docmirror/dev-sidecar?logo=github&cacheSeconds=86400"></a>
77

88
[![Star History Chart](https://api.star-history.com/svg?repos=docmirror/dev-sidecar&type=date&legend=top-left)](https://www.star-history.com/#docmirror/dev-sidecar&type=date&legend=top-left)
99

@@ -300,12 +300,12 @@ networksetup -setwebproxy 'WiFi' 127.0.0.1 31181
300300
#### 3)火狐浏览器:火狐浏览器不走系统的根证书,需要在选项中添加根证书
301301

302302
1. 火狐浏览器->选项->隐私与安全->证书->查看证书
303-
![](./doc/figures/Firefox/1.png)
303+
![](./doc/Firefox/1.png)
304304
2. 证书颁发机构->导入
305305
3. 选择证书文件 `C:\Users(用户)\Administrator(你的账号)\.dev-sidecar\dev-sidecar.ca.crt`(Mac或linux为 `~/.dev-sidecar` 目录)
306-
![](./doc/figures/Firefox/2.png)
306+
![](./doc/Firefox/2.png)
307307
4. 勾选信任由此证书颁发机构来标识网站,确定即可
308-
![](./doc/figures/Firefox/3.png)
308+
![](./doc/Firefox/3.png)
309309

310310
### 6.4、打开github显示连接超时
311311

_script/0、updateDependencies.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ ncu -u
1111

1212
# cd ../packages/mitmproxy
1313
# ncu -u
14+
15+
cmd

_script/1、setupEnv.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node -v
22

33
cd ../
44
npm install -g pnpm --registry=https://registry.npmmirror.com
5+
6+
cmd

_script/2、installProject.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ node -v
22

33
cd ../
44
chcp 65001
5-
pnpm install
5+
pnpm install --registry=https://registry.npmmirror.com
6+
7+
cmd

_script/3、buildAndRun.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ node -v
33
cd ../packages/gui
44
chcp 65001
55
npm run electron
6+
7+
cmd

_script/4.1、runTestCore.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node -v
22

33
cd ../packages/core
44
pnpm run test
5+
6+
cmd

_script/4.2、runTestMitmproxy.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node -v
22

33
cd ../packages/mitmproxy
44
pnpm run test
5+
6+
cmd

_script/5、generateSetupFile.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ if not exist "dist_electron" mkdir "dist_electron"
66
start dist_electron
77

88
npm run electron:build
9+
10+
cmd

packages/aur/PKGBUILD

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Maintainer: Greper <xiaojunnuo@qq.com>
2+
pkgname=dev-sidecar-bin
3+
pkgver=2.0.2
4+
pkgrel=1
5+
pkgdesc="给开发者的边车辅助工具,通过代理的方式来改善国内访问github等境外网站的情况"
6+
arch=('x86_64' 'aarch64')
7+
url="https://github.com/docmirror/dev-sidecar"
8+
license=('MPL-2.0')
9+
depends=('libnotify' 'libappindicator-gtk3' 'libxtst' 'nss' 'libxss' 'gtk3')
10+
provides=('dev-sidecar')
11+
conflicts=('dev-sidecar')
12+
options=('!strip')
13+
14+
source_x86_64=("https://github.com/docmirror/dev-sidecar/releases/download/v${pkgver}/DevSidecar-${pkgver}-linux-x86_64.tar.gz")
15+
source_aarch64=("https://github.com/docmirror/dev-sidecar/releases/download/v${pkgver}/DevSidecar-${pkgver}-linux-arm64.tar.gz")
16+
17+
sha256sums_x86_64=('SKIP')
18+
sha256sums_aarch64=('SKIP')
19+
20+
package() {
21+
local _installdir="${pkgdir}/opt/${pkgname%-bin}"
22+
23+
install -dm755 "${_installdir}"
24+
cp -r "${srcdir}/"* "${_installdir}/"
25+
26+
# chrome-sandbox must be setuid root
27+
if [[ -f "${_installdir}/chrome-sandbox" ]]; then
28+
chmod 4755 "${_installdir}/chrome-sandbox"
29+
fi
30+
31+
# symlink the main executable into PATH
32+
install -dm755 "${pkgdir}/usr/bin"
33+
ln -sf "/opt/${pkgname%-bin}/dev-sidecar" "${pkgdir}/usr/bin/dev-sidecar"
34+
35+
# desktop entry
36+
install -dm755 "${pkgdir}/usr/share/applications"
37+
cat > "${pkgdir}/usr/share/applications/dev-sidecar.desktop" << EOF
38+
[Desktop Entry]
39+
Name=DevSidecar
40+
Comment=给开发者的边车辅助工具
41+
Exec=/opt/dev-sidecar/dev-sidecar %U
42+
Icon=dev-sidecar
43+
Terminal=false
44+
Type=Application
45+
Categories=Utility;System;
46+
StartupNotify=true
47+
EOF
48+
49+
# application icon (if provided by the package)
50+
if [[ -f "${_installdir}/resources/app/public/logo/linux.png" ]]; then
51+
install -Dm644 "${_installdir}/resources/app/public/logo/linux.png" \
52+
"${pkgdir}/usr/share/pixmaps/dev-sidecar.png"
53+
fi
54+
}

0 commit comments

Comments
 (0)