-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (134 loc) · 5.17 KB
/
Copy pathalpha.yml
File metadata and controls
146 lines (134 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Box Custom Alpha
on:
push:
branches: [test]
paths-ignore:
- "README.md"
- "docs/**"
workflow_dispatch:
concurrency:
group: box-alpha-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
package:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Check out source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check out Tailscale UI
uses: actions/checkout@v6
with:
repository: JSJ-Experiments/mihomo-tailscale-ui
ref: main
path: .ui-source
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: .ui-source/package-lock.json
- name: Build Tailscale UI
shell: bash
run: |
npm --prefix .ui-source ci
npm --prefix .ui-source run build
- name: Set up Android NDK
id: ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r29-beta1
- name: Build public-key-only Dropbear for Android
shell: bash
env:
NDK: ${{ steps.ndk.outputs.ndk-path }}
DROPBEAR_VERSION: "2026.94"
DROPBEAR_SHA256: "e098034a843699200c8c977a991fff73159735bf795d5f72ef672c41a6b1ae81"
run: |
source_url="https://matt.ucc.asn.au/dropbear/releases/dropbear-${DROPBEAR_VERSION}.tar.bz2"
curl --fail --location --retry 3 "$source_url" -o dropbear.tar.bz2
echo "${DROPBEAR_SHA256} dropbear.tar.bz2" | sha256sum --check -
tar -xjf dropbear.tar.bz2
source_dir="$PWD/dropbear-${DROPBEAR_VERSION}"
cp build/dropbear-localoptions.h "$source_dir/localoptions.h"
patch -d "$source_dir" -p1 < build/dropbear-android-authorized-keys.patch
toolchain="$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin"
export CC="$toolchain/aarch64-linux-android24-clang"
export AR="$toolchain/llvm-ar"
export RANLIB="$toolchain/llvm-ranlib"
export STRIP="$toolchain/llvm-strip"
export CFLAGS="-Os -fPIE"
export LDFLAGS="-Wl,-z,relro,-z,now -pie"
cd "$source_dir"
./configure \
--host=aarch64-linux-android \
--disable-zlib \
--disable-syslog \
--disable-shadow \
--disable-lastlog \
--disable-utmp \
--disable-utmpx \
--disable-wtmp \
--disable-wtmpx
make -j"$(nproc)" PROGRAMS="dropbear dropbearkey scp"
"$STRIP" dropbear dropbearkey scp
mkdir -p "$GITHUB_WORKSPACE/box/bin" "$GITHUB_WORKSPACE/box/licenses"
cp dropbear dropbearkey scp "$GITHUB_WORKSPACE/box/bin/"
cp LICENSE "$GITHUB_WORKSPACE/box/licenses/dropbear-LICENSE"
- name: Build module and update metadata
shell: bash
run: |
short_sha="$(git rev-parse --short HEAD)"
version="alpha-${short_sha}"
version_code="$(git show -s --format=%ct HEAD)"
mkdir -p box/mihomo/tailscale-ui
cp -a .ui-source/dist/. box/mihomo/tailscale-ui/
mkdir -p staging dist
rsync -a ./ staging/ \
--exclude .git \
--exclude .github \
--exclude .ui-source \
--exclude '/dropbear-*/' \
--exclude '/dropbear.tar.bz2' \
--exclude docs \
--exclude '/build/' \
--exclude staging \
--exclude dist \
--exclude CHANGELOG.md \
--exclude update.json \
--exclude build.sh \
--exclude LICENSE
sed -i "s/^version=.*/version=${version}/" staging/module.prop
sed -i "s/^versionCode=.*/versionCode=${version_code}/" staging/module.prop
sed -i 's#^updateJson=.*#updateJson=https://github.com/JSJ-Experiments/box/releases/download/Prerelease-Alpha/update.json#' staging/module.prop
(cd staging && zip -r -9 -X ../dist/box-alpha.zip .)
cat > dist/update.json <<JSON
{
"version": "${version}",
"versionCode": ${version_code},
"zipUrl": "https://github.com/JSJ-Experiments/box/releases/download/Prerelease-Alpha/box-alpha.zip",
"changelog": "https://raw.githubusercontent.com/JSJ-Experiments/box/test/CHANGELOG.md"
}
JSON
sha256sum dist/box-alpha.zip > dist/checksums.txt
printf '%s\n' "$version" > dist/version.txt
cat dist/update.json
- name: Replace moving alpha release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
tag="Prerelease-Alpha"
version="$(cat dist/version.txt)"
if gh release view "$tag" >/dev/null 2>&1; then
gh release delete "$tag" --yes
fi
git tag -f "$tag" "$GITHUB_SHA"
git push origin "refs/tags/$tag" --force
gh release create "$tag" dist/* \
--prerelease \
--title "Box Custom $version" \
--notes "JSJ-Experiments alpha build. This module defaults to the JSJ custom Mihomo release and can update Mihomo without reflashing."