Skip to content

Commit 8b426be

Browse files
committed
feat: add Termux build support and update build configuration #1479
1 parent 99fc7ff commit 8b426be

File tree

4 files changed

+138
-2
lines changed

4 files changed

+138
-2
lines changed

.github/build/build_info.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@
2121
"386": {"arch": "i686", "name": "windows-32"},
2222
"amd64": {"arch": "x86_64", "name": "windows-64"},
2323
"arm64": {"arch": "aarch64", "name": "windows-arm64-v8a"}
24+
},
25+
"termux": {
26+
"arm64": {"arch": "aarch64", "name": "termux-arm64-v8a"}
2427
}
2528
}

.github/workflows/build.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,140 @@ jobs:
299299
300300
echo "Upload completed successfully"
301301
302+
build_termux:
303+
runs-on: ubuntu-latest
304+
needs: build_app
305+
env:
306+
CGO_ENABLED: 1
307+
GOOS: android
308+
GOARCH: arm64
309+
steps:
310+
- name: Checkout
311+
uses: actions/checkout@v6
312+
313+
- name: Set up Go
314+
uses: actions/setup-go@v6
315+
with:
316+
go-version: ^1.25.5
317+
cache: false
318+
319+
- name: Setup environment
320+
id: info_termux
321+
run: |
322+
export _NAME=$(jq ".termux[\"$GOARCH\"].name" -r < .github/build/build_info.json)
323+
export _ARTIFACT=nginx-ui-$_NAME
324+
export _BINARY=nginx-ui
325+
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME, ARTIFACT_NAME: $_ARTIFACT, BINARY_NAME: $_BINARY"
326+
echo "CACHE_NAME=$_NAME" >> $GITHUB_ENV
327+
echo "DIST=nginx-ui-$_NAME" >> $GITHUB_ENV
328+
echo "ARTIFACT=$_ARTIFACT" >> $GITHUB_ENV
329+
echo "BINARY_NAME=$_BINARY" >> $GITHUB_ENV
330+
331+
- name: Setup Go modules cache
332+
uses: actions/cache@v4
333+
with:
334+
path: |
335+
~/go/pkg/mod
336+
key: go-${{ runner.os }}-${{ runner.arch }}-mod-${{ hashFiles('**/go.sum') }}
337+
restore-keys: |
338+
go-${{ runner.os }}-${{ runner.arch }}-mod-
339+
340+
- name: Setup Go build cache
341+
uses: actions/cache@v4
342+
with:
343+
path: |
344+
~/.cache/go-build
345+
key: go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-${{ hashFiles('**/go.sum') }}
346+
restore-keys: |
347+
go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-
348+
349+
- name: Download app artifacts
350+
uses: actions/download-artifact@v6
351+
with:
352+
name: app-dist
353+
path: frontend-dist
354+
355+
- name: Prepare frontend assets
356+
run: |
357+
rm -rf app/dist
358+
mkdir -p app
359+
if [[ -d frontend-dist/app/dist ]]; then
360+
mv frontend-dist/app/dist app/dist
361+
elif [[ -d frontend-dist/dist ]]; then
362+
mv frontend-dist/dist app/dist
363+
else
364+
mv frontend-dist app/dist
365+
fi
366+
367+
- name: Generate files
368+
env:
369+
GOOS: linux
370+
GOARCH: amd64
371+
run: go generate cmd/version/generate.go
372+
373+
- name: Set up Android NDK
374+
id: ndk
375+
uses: nttld/setup-ndk@v1
376+
with:
377+
ndk-version: r27c
378+
379+
- name: Configure Android toolchain
380+
run: |
381+
API_LEVEL=24
382+
TOOLCHAIN="${{ steps.ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
383+
echo "PATH=$TOOLCHAIN:$PATH" >> $GITHUB_ENV
384+
echo "ANDROID_API_LEVEL=$API_LEVEL" >> $GITHUB_ENV
385+
echo "CC=aarch64-linux-android${API_LEVEL}-clang" >> $GITHUB_ENV
386+
echo "CXX=aarch64-linux-android${API_LEVEL}-clang++" >> $GITHUB_ENV
387+
echo "LD_FLAGS=-w" >> $GITHUB_ENV
388+
echo "GOOS=android" >> $GITHUB_ENV
389+
echo "GOARCH=arm64" >> $GITHUB_ENV
390+
echo "CGO_ENABLED=1" >> $GITHUB_ENV
391+
392+
- name: Build
393+
env:
394+
GOOS: android
395+
GOARCH: arm64
396+
CGO_ENABLED: 1
397+
run: |
398+
mkdir -p dist
399+
go build -trimpath -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o dist/$BINARY_NAME -v main.go
400+
401+
- name: Archive backend artifacts
402+
uses: actions/upload-artifact@v5
403+
with:
404+
name: ${{ env.ARTIFACT }}
405+
path: dist/${{ env.BINARY_NAME }}
406+
407+
- name: Prepare publish
408+
run: |
409+
cp README*.md ./dist
410+
find dist -printf '%P\n' | tar -C dist --no-recursion -zcvf ${{ env.DIST }}.tar.gz -T -
411+
openssl dgst -sha512 ${{ env.DIST }}.tar.gz | sed 's/([^)]*)//g' | awk '{print $NF}' >> ${{ env.DIST }}.tar.gz.digest
412+
413+
- name: Publish
414+
uses: softprops/action-gh-release@v2
415+
if: github.event_name == 'release'
416+
with:
417+
files: |
418+
${{ env.DIST }}.tar.gz
419+
${{ env.DIST }}.tar.gz.digest
420+
421+
- name: Upload to R2 using S3 API
422+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/dev'
423+
env:
424+
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
425+
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
426+
AWS_REGION: us-east-1
427+
run: |
428+
echo "Uploading ${{ env.DIST }}.tar.gz to R2..."
429+
aws s3 cp ./${{ env.DIST }}.tar.gz s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }}
430+
431+
echo "Uploading ${{ env.DIST }}.tar.gz.digest to R2..."
432+
aws s3 cp ./${{ env.DIST }}.tar.gz.digest s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz.digest --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }}
433+
434+
echo "Upload completed successfully"
435+
302436
build_macos_native:
303437
runs-on: macos-latest
304438
needs: build_app

app/src/views/nginx_log/components/IndexingSettingsModal.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ function handleCancel() {
179179
</ATypographyTitle>
180180

181181
<GeoLiteDownload
182-
ref="geoLiteDownloadRef"
183182
@download-complete="onGeoLiteDownloadComplete"
184183
/>
185184
</div>

app/src/views/terminal/Terminal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ const terminalMainContainerHeight = computed(() => {
198198
show-icon
199199
:message="$gettext('You are accessing this terminal over an insecure HTTP connection on a non-localhost domain. This may expose sensitive information.')"
200200
/>
201-
<div ref="terminalLayoutRef" class="terminal-layout">
201+
<div class="terminal-layout">
202202
<div class="terminal-container" :style="{ height: terminalMainContainerHeight }">
203203
<TerminalHeader
204204
:tabs="terminalStore.tabs"

0 commit comments

Comments
 (0)