feat(ci):Add lite version build and standardize Action naming (#464)

* add lite version

* fixed lite ci

* test

* fixed lite version

* fixed release build md5 and tar

* fixed lite

* fixed release ci

* fixed ci secrets

* fixed ci

* fixed ci

* fixed docker ci

* fixed docker ci

* fixed ci

* fixed docker ci

* fixed docker ci

* fixed docker ci

* ci:delete lite in beta version

* feat(ci):Add Lite Version Build

* Fixed Beta version Docker

* Fixed Web Lite

* fixed EOL

* fixed EOL

---------

Co-authored-by: Sumengjing <146963948+suyunjing-su@users.noreply.github.com>
This commit is contained in:
Suyunjing
2025-06-28 22:22:16 +08:00
committed by GitHub
parent 76a1f99df1
commit 060fd36883
11 changed files with 491 additions and 114 deletions

View File

@ -1,4 +1,4 @@
name: beta release name: Beta Release builds
on: on:
push: push:
@ -141,33 +141,3 @@ jobs:
path: ${{ github.workspace }}/build/compress/* path: ${{ github.workspace }}/build/compress/*
compression-level: 0 compression-level: 0
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
# TODO: We do not have desktop clients right now. We may need a better way to
# trigger the build of desktop client when we actually have it.
# desktop:
# needs:
# - release
# name: Beta Release Desktop
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
# with:
# repository: openlistteam/desktop-release
# ref: main
# persist-credentials: false
# fetch-depth: 0
# - name: Commit
# run: |
# git config --local user.email "bot@nn.ci"
# git config --local user.name "IlaBot"
# git commit --allow-empty -m "Trigger build for ${{ github.sha }}"
# - name: Push commit
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.MY_TOKEN }}
# branch: main
# repository: openlistteam/desktop-release

View File

@ -1,4 +1,4 @@
name: build name: Test Build
on: on:
push: push:
@ -61,4 +61,4 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: openlist_${{ env.SHA }}_${{ matrix.target }} name: openlist_${{ env.SHA }}_${{ matrix.target }}
path: build/* path: build/*

View File

@ -1,10 +1,13 @@
name: auto changelog name: Automatic changelog
on: on:
push: push:
tags: tags:
- 'v*' - 'v*'
permissions:
contents: write
jobs: jobs:
changelog: changelog:
name: Create Release name: Create Release

View File

@ -1,9 +1,11 @@
name: release name: Release builds
on: on:
release: release:
types: [ published ] types: [ published ]
permissions: write-all
permissions:
contents: write
jobs: jobs:
release: release:
@ -67,32 +69,64 @@ jobs:
files: build/compress/* files: build/compress/*
prerelease: false prerelease: false
release-lite:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ '1.21' ]
name: Release Lite
runs-on: ${{ matrix.platform }}
steps:
# TODO: We do not have desktop clients right now. We may need a better way to - name: Free Disk Space (Ubuntu)
# trigger the build of desktop client when we actually have it. uses: jlumbroso/free-disk-space@main
# release_desktop: with:
# needs: release # this might remove tools that are actually needed,
# name: Release desktop # if set to "true" but frees about 6 GB
# runs-on: ubuntu-latest tool-cache: false
# steps:
# - name: Checkout repo # all of these default to true, but feel free to set to
# uses: actions/checkout@v4 # "false" if necessary for your workflow
# with: android: true
# repository: openlistteam/desktop-release dotnet: true
# ref: main haskell: true
# persist-credentials: false large-packages: true
# fetch-depth: 0 docker-images: true
swap-storage: true
# - name: Add tag - name: Prerelease
# run: | uses: irongut/EditRelease@v1.2.0
# git config --local user.email "bot@nn.ci" with:
# git config --local user.name "IlaBot" token: ${{ secrets.GITHUB_TOKEN }}
# version=$(wget -qO- -t1 -T2 "https://api.github.com/repos/openlistteam/openlist/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') id: ${{ github.event.release.id }}
# git tag -a $version -m "release $version" prerelease: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo snap install zig --classic --beta
docker pull crazymax/xgo:latest
go install github.com/crazy-max/xgo@latest
sudo apt install upx
- name: Build
run: |
bash build.sh release lite
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: softprops/action-gh-release@v2
with:
files: build/compress/*
prerelease: false
# - name: Push tags
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.MY_TOKEN }}
# branch: main
# repository: openlistteam/desktop-release

View File

@ -1,10 +1,11 @@
name: release_android name: Release builds (Android)
on: on:
release: release:
types: [ published ] types: [ published ]
permissions: write-all permissions:
contents: write
jobs: jobs:
release_android: release_android:
@ -36,3 +37,33 @@ jobs:
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: build/compress/* files: build/compress/*
release_android_lite:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ '1.21' ]
name: Release
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
bash build.sh release lite android
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: softprops/action-gh-release@v2
with:
files: build/compress/*

View File

@ -1,4 +1,4 @@
name: release_docker name: Release builds (Docker)
on: on:
workflow_dispatch: workflow_dispatch:
@ -24,18 +24,21 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
ORG_NAME: openlistteam DOCKERHUB_ORG_NAME: ${{ vars.DOCKERHUB_ORG_NAME || 'openlistteam' }}
GHCR_ORG_NAME: ${{ vars.GHCR_ORG_NAME || 'openlistteam' }}
IMAGE_NAME: openlist-git IMAGE_NAME: openlist-git
IMAGE_NAME_DOCKERHUB: openlist IMAGE_NAME_DOCKERHUB: openlist
REGISTRY: ghcr.io REGISTRY: ghcr.io
ARTIFACT_NAME: 'binaries_docker_release' ARTIFACT_NAME: 'binaries_docker_release'
ARTIFACT_NAME_LITE: 'binaries_docker_release_lite'
RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64' RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64'
IMAGE_PUSH: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} IMAGE_PUSH: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
IMAGE_IS_PROD: ${{ github.ref_type == 'tag' || github.event.inputs.as_latest == 'true' }} IMAGE_IS_PROD: ${{ github.ref_type == 'tag' || github.event.inputs.as_latest == 'true' }}
IMAGE_TAGS_BETA: | IMAGE_TAGS_BETA: |
type=raw,value=beta,enable={{is_default_branch}} type=raw,value=beta,enable={{is_default_branch}}
permissions: write-all permissions:
packages: write
jobs: jobs:
build_binary: build_binary:
@ -84,6 +87,52 @@ jobs:
!build/*.tgz !build/*.tgz
!build/musl-libs/** !build/musl-libs/**
build_binary_lite:
name: Build Binaries for Docker Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Cache Musl
id: cache-musl
uses: actions/cache@v4
with:
path: build/musl-libs
key: docker-musl-libs-v2
- name: Download Musl Library
if: steps.cache-musl.outputs.cache-hit != 'true'
run: bash build.sh prepare lite docker-multiplatform
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build go binary (beta)
if: env.IMAGE_IS_PROD != 'true'
run: bash build.sh beta lite docker-multiplatform
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build go binary (release)
if: env.IMAGE_IS_PROD == 'true'
run: bash build.sh release lite docker-multiplatform
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME_LITE }}
overwrite: true
path: |
build/
!build/*.tgz
!build/musl-libs/**
release_docker: release_docker:
needs: build_binary needs: build_binary
name: Release Docker image name: Release Docker image
@ -132,7 +181,7 @@ jobs:
if: env.IMAGE_PUSH == 'true' if: env.IMAGE_PUSH == 'true'
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ env.ORG_NAME }} username: ${{ env.DOCKERHUB_ORG_NAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta - name: Docker meta
@ -140,8 +189,88 @@ jobs:
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: | images: |
${{ env.REGISTRY }}/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
${{ env.ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }} ${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }}
tags: >
${{ env.IMAGE_IS_PROD == 'true' && (
github.event_name == 'workflow_dispatch'
&& format('type=raw,value={0}', github.event.inputs.manual_tag)
|| format('type=raw,value={0}', github.ref_name)
) || env.IMAGE_TAGS_BETA }}
flavor: |
latest=${{ env.IMAGE_IS_PROD }}
${{ matrix.tag_favor }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.ci
push: ${{ env.IMAGE_PUSH == 'true' }}
build-args: ${{ matrix.build_arg }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.RELEASE_PLATFORMS }}
release_docker_lite:
needs: build_binary_lite
name: Release Docker image
runs-on: ubuntu-latest
strategy:
matrix:
image: ["latest", "ffmpeg", "aria2", "aio"]
include:
- image: "latest"
build_arg: ""
tag_favor: "suffix=-lite,onlatest=true"
- image: "ffmpeg"
build_arg: INSTALL_FFMPEG=true
tag_favor: "suffix=-lite-ffmpeg,onlatest=true"
- image: "aria2"
build_arg: INSTALL_ARIA2=true
tag_favor: "suffix=-lite-aria2,onlatest=true"
- image: "aio"
build_arg: |
INSTALL_FFMPEG=true
INSTALL_ARIA2=true
tag_favor: "suffix=-lite-aio,onlatest=true"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME_LITE }}
path: 'build/'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: env.IMAGE_PUSH == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub Container Registry
if: env.IMAGE_PUSH == 'true'
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_ORG_NAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }}
tags: > tags: >
${{ env.IMAGE_IS_PROD == 'true' && ( ${{ env.IMAGE_IS_PROD == 'true' && (
github.event_name == 'workflow_dispatch' github.event_name == 'workflow_dispatch'

View File

@ -1,12 +1,13 @@
name: release_freebsd name: Release builds (Freebsd)
on: on:
release: release:
types: [ published ] types: [ published ]
permissions: write-all permissions:
jobs: contents: write
jobs:
release_freebsd: release_freebsd:
strategy: strategy:
matrix: matrix:
@ -36,3 +37,33 @@ jobs:
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: build/compress/* files: build/compress/*
release_freebsd_lite:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ '1.21' ]
name: Release
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
bash build.sh release lite freebsd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: softprops/action-gh-release@v2
with:
files: build/compress/*

View File

@ -1,9 +1,12 @@
name: release_linux_musl name: Release builds (linux_musl)
on: on:
release: release:
types: [ published ] types: [ published ]
permissions: write-all
permissions:
contents: write
jobs: jobs:
release_linux_musl: release_linux_musl:
strategy: strategy:
@ -34,3 +37,33 @@ jobs:
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: build/compress/* files: build/compress/*
release_linux_musl_lite:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ '1.21' ]
name: Release
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
bash build.sh release lite linux_musl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: softprops/action-gh-release@v2
with:
files: build/compress/*

View File

@ -1,10 +1,12 @@
name: release_linux_musl_arm name: Release builds (linux_musl_arm)
on: on:
release: release:
types: [ published ] types: [ published ]
permissions: write-all permissions:
contents: write
jobs: jobs:
release_linux_musl_arm: release_linux_musl_arm:
strategy: strategy:
@ -35,3 +37,34 @@ jobs:
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: build/compress/* files: build/compress/*
release_linux_musl_arm_lite:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ '1.21' ]
name: Release
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
bash build.sh release lite linux_musl_arm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: softprops/action-gh-release@v2
with:
files: build/compress/*

View File

@ -1,4 +1,4 @@
name: test_docker name: Docker Beta Release
on: on:
workflow_dispatch: workflow_dispatch:
@ -14,11 +14,13 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
ORG_NAME: openlistteam DOCKERHUB_ORG_NAME: ${{ vars.DOCKERHUB_ORG_NAME || 'openlistteam' }}
GHCR_ORG_NAME: ${{ vars.GHCR_ORG_NAME || 'openlistteam' }}
IMAGE_NAME: openlist-git IMAGE_NAME: openlist-git
IMAGE_NAME_DOCKERHUB: openlist IMAGE_NAME_DOCKERHUB: openlist
REGISTRY: ghcr.io REGISTRY: ghcr.io
ARTIFACT_NAME: 'binaries_docker_release' ARTIFACT_NAME: 'binaries_docker_release'
ARTIFACT_NAME_LITE: 'binaries_docker_release_lite'
RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64' RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64'
IMAGE_PUSH: ${{ github.event_name == 'push' }} IMAGE_PUSH: ${{ github.event_name == 'push' }}
IMAGE_TAGS_BETA: | IMAGE_TAGS_BETA: |
@ -70,7 +72,6 @@ jobs:
name: Release Docker image name: Release Docker image
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read
packages: write packages: write
strategy: strategy:
matrix: matrix:
@ -116,7 +117,7 @@ jobs:
if: env.IMAGE_PUSH == 'true' if: env.IMAGE_PUSH == 'true'
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ env.ORG_NAME }} username: ${{ env.DOCKERHUB_ORG_NAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta - name: Docker meta
@ -124,8 +125,8 @@ jobs:
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: | images: |
${{ env.REGISTRY }}/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
${{ env.ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }} ${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }}
tags: ${{ env.IMAGE_TAGS_BETA }} tags: ${{ env.IMAGE_TAGS_BETA }}
flavor: | flavor: |
${{ matrix.tag_favor }} ${{ matrix.tag_favor }}

174
build.sh
View File

@ -9,6 +9,12 @@ if [ -n "$GITHUB_TOKEN" ]; then
githubAuthArgs="--header \"Authorization: Bearer $GITHUB_TOKEN\"" githubAuthArgs="--header \"Authorization: Bearer $GITHUB_TOKEN\""
fi fi
# Check for lite parameter
useLite=false
if [[ "$*" == *"lite"* ]]; then
useLite=true
fi
if [ "$1" = "dev" ]; then if [ "$1" = "dev" ]; then
version="dev" version="dev"
webVersion="dev" webVersion="dev"
@ -24,6 +30,11 @@ fi
echo "backend version: $version" echo "backend version: $version"
echo "frontend version: $webVersion" echo "frontend version: $webVersion"
if [ "$useLite" = true ]; then
echo "using lite frontend"
else
echo "using standard frontend"
fi
ldflags="\ ldflags="\
-w -s \ -w -s \
@ -43,7 +54,13 @@ FetchWebDev() {
pre_release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/tags/$pre_release_tag\"") pre_release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/tags/$pre_release_tag\"")
fi fi
pre_release_assets=$(echo "$pre_release_json" | jq -r '.assets[].browser_download_url') pre_release_assets=$(echo "$pre_release_json" | jq -r '.assets[].browser_download_url')
pre_release_tar_url=$(echo "$pre_release_assets" | grep "openlist-frontend-dist" | grep "\.tar\.gz$")
if [ "$useLite" = true ]; then
pre_release_tar_url=$(echo "$pre_release_assets" | grep "openlist-frontend-dist-lite" | grep "\.tar\.gz$")
else
pre_release_tar_url=$(echo "$pre_release_assets" | grep "openlist-frontend-dist" | grep -v "lite" | grep "\.tar\.gz$")
fi
curl -fsSL "$pre_release_tar_url" -o web-dist-dev.tar.gz curl -fsSL "$pre_release_tar_url" -o web-dist-dev.tar.gz
rm -rf public/dist && mkdir -p public/dist rm -rf public/dist && mkdir -p public/dist
tar -zxvf web-dist-dev.tar.gz -C public/dist tar -zxvf web-dist-dev.tar.gz -C public/dist
@ -53,7 +70,13 @@ FetchWebDev() {
FetchWebRelease() { FetchWebRelease() {
release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"") release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"")
release_assets=$(echo "$release_json" | jq -r '.assets[].browser_download_url') release_assets=$(echo "$release_json" | jq -r '.assets[].browser_download_url')
release_tar_url=$(echo "$release_assets" | grep "openlist-frontend-dist" | grep "\.tar\.gz$")
if [ "$useLite" = true ]; then
release_tar_url=$(echo "$release_assets" | grep "openlist-frontend-dist-lite" | grep "\.tar\.gz$")
else
release_tar_url=$(echo "$release_assets" | grep "openlist-frontend-dist" | grep -v "lite" | grep "\.tar\.gz$")
fi
curl -fsSL "$release_tar_url" -o dist.tar.gz curl -fsSL "$release_tar_url" -o dist.tar.gz
rm -rf public/dist && mkdir -p public/dist rm -rf public/dist && mkdir -p public/dist
tar -zxvf dist.tar.gz -C public/dist tar -zxvf dist.tar.gz -C public/dist
@ -293,82 +316,171 @@ MakeRelease() {
rm -rv compress rm -rv compress
fi fi
mkdir compress mkdir compress
# Add -lite suffix if useLite is true
liteSuffix=""
if [ "$useLite" = true ]; then
liteSuffix="-lite"
fi
for i in $(find . -type f -name "$appName-linux-*"); do for i in $(find . -type f -name "$appName-linux-*"); do
cp "$i" "$appName" cp "$i" "$appName"
tar -czvf compress/"$i".tar.gz "$appName" tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
rm -f "$appName" rm -f "$appName"
done done
for i in $(find . -type f -name "$appName-android-*"); do for i in $(find . -type f -name "$appName-android-*"); do
cp "$i" "$appName" cp "$i" "$appName"
tar -czvf compress/"$i".tar.gz "$appName" tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
rm -f "$appName" rm -f "$appName"
done done
for i in $(find . -type f -name "$appName-darwin-*"); do for i in $(find . -type f -name "$appName-darwin-*"); do
cp "$i" "$appName" cp "$i" "$appName"
tar -czvf compress/"$i".tar.gz "$appName" tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
rm -f "$appName" rm -f "$appName"
done done
for i in $(find . -type f -name "$appName-freebsd-*"); do for i in $(find . -type f -name "$appName-freebsd-*"); do
cp "$i" "$appName" cp "$i" "$appName"
tar -czvf compress/"$i".tar.gz "$appName" tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
rm -f "$appName" rm -f "$appName"
done done
for i in $(find . -type f -name "$appName-windows-*"); do for i in $(find . -type f -name "$appName-windows-*"); do
cp "$i" "$appName".exe cp "$i" "$appName".exe
zip compress/$(echo $i | sed 's/\.[^.]*$//').zip "$appName".exe zip compress/$(echo $i | sed 's/\.[^.]*$//')$liteSuffix.zip "$appName".exe
rm -f "$appName".exe rm -f "$appName".exe
done done
cd compress cd compress
find . -type f -print0 | xargs -0 md5sum >"$1"
cat "$1" # Handle MD5 filename - add -lite suffix only if not already present
md5FileName="$1"
if [ "$useLite" = true ] && [[ "$1" != *"-lite.txt" ]]; then
md5FileName=$(echo "$1" | sed 's/\.txt$/-lite.txt/')
fi
find . -type f -print0 | xargs -0 md5sum >"$md5FileName"
cat "$md5FileName"
cd ../.. cd ../..
} }
if [ "$1" = "dev" ]; then # Parse parameters to handle lite parameter position flexibility
buildType=""
dockerType=""
otherParam=""
for arg in "$@"; do
case $arg in
dev|beta|release|zip|prepare)
if [ -z "$buildType" ]; then
buildType="$arg"
fi
;;
docker|docker-multiplatform|linux_musl_arm|linux_musl|android|freebsd|web)
if [ -z "$dockerType" ]; then
dockerType="$arg"
fi
;;
lite)
# lite parameter is already handled above
;;
*)
if [ -z "$otherParam" ]; then
otherParam="$arg"
fi
;;
esac
done
if [ "$buildType" = "dev" ]; then
FetchWebDev FetchWebDev
if [ "$2" = "docker" ]; then if [ "$dockerType" = "docker" ]; then
BuildDocker BuildDocker
elif [ "$2" = "docker-multiplatform" ]; then elif [ "$dockerType" = "docker-multiplatform" ]; then
BuildDockerMultiplatform BuildDockerMultiplatform
elif [ "$2" = "web" ]; then elif [ "$dockerType" = "web" ]; then
echo "web only" echo "web only"
else else
BuildDev BuildDev
fi fi
elif [ "$1" = "release" -o "$1" = "beta" ]; then elif [ "$buildType" = "release" -o "$buildType" = "beta" ]; then
if [ "$1" = "beta" ]; then if [ "$buildType" = "beta" ]; then
FetchWebDev FetchWebDev
else else
FetchWebRelease FetchWebRelease
fi fi
if [ "$2" = "docker" ]; then if [ "$dockerType" = "docker" ]; then
BuildDocker BuildDocker
elif [ "$2" = "docker-multiplatform" ]; then elif [ "$dockerType" = "docker-multiplatform" ]; then
BuildDockerMultiplatform BuildDockerMultiplatform
elif [ "$2" = "linux_musl_arm" ]; then elif [ "$dockerType" = "linux_musl_arm" ]; then
BuildReleaseLinuxMuslArm BuildReleaseLinuxMuslArm
MakeRelease "md5-linux-musl-arm.txt" if [ "$useLite" = true ]; then
elif [ "$2" = "linux_musl" ]; then MakeRelease "md5-linux-musl-arm-lite.txt"
else
MakeRelease "md5-linux-musl-arm.txt"
fi
elif [ "$dockerType" = "linux_musl" ]; then
BuildReleaseLinuxMusl BuildReleaseLinuxMusl
MakeRelease "md5-linux-musl.txt" if [ "$useLite" = true ]; then
elif [ "$2" = "android" ]; then MakeRelease "md5-linux-musl-lite.txt"
else
MakeRelease "md5-linux-musl.txt"
fi
elif [ "$dockerType" = "android" ]; then
BuildReleaseAndroid BuildReleaseAndroid
MakeRelease "md5-android.txt" if [ "$useLite" = true ]; then
elif [ "$2" = "freebsd" ]; then MakeRelease "md5-android-lite.txt"
else
MakeRelease "md5-android.txt"
fi
elif [ "$dockerType" = "freebsd" ]; then
BuildReleaseFreeBSD BuildReleaseFreeBSD
MakeRelease "md5-freebsd.txt" if [ "$useLite" = true ]; then
elif [ "$2" = "web" ]; then MakeRelease "md5-freebsd-lite.txt"
else
MakeRelease "md5-freebsd.txt"
fi
elif [ "$dockerType" = "web" ]; then
echo "web only" echo "web only"
else else
BuildRelease BuildRelease
MakeRelease "md5.txt" if [ "$useLite" = true ]; then
MakeRelease "md5-lite.txt"
else
MakeRelease "md5.txt"
fi
fi fi
elif [ "$1" = "prepare" ]; then elif [ "$buildType" = "prepare" ]; then
if [ "$2" = "docker-multiplatform" ]; then if [ "$dockerType" = "docker-multiplatform" ]; then
PrepareBuildDockerMusl PrepareBuildDockerMusl
fi fi
elif [ "$1" = "zip" ]; then elif [ "$buildType" = "zip" ]; then
MakeRelease "$2".txt if [ -n "$otherParam" ]; then
if [ "$useLite" = true ]; then
MakeRelease "$otherParam-lite.txt"
else
MakeRelease "$otherParam.txt"
fi
elif [ -n "$dockerType" ]; then
if [ "$useLite" = true ]; then
MakeRelease "$dockerType-lite.txt"
else
MakeRelease "$dockerType.txt"
fi
else
if [ "$useLite" = true ]; then
MakeRelease "md5-lite.txt"
else
MakeRelease "md5.txt"
fi
fi
else else
echo -e "Parameter error" echo -e "Parameter error"
echo -e "Usage: $0 {dev|beta|release|zip|prepare} [docker|docker-multiplatform|linux_musl_arm|linux_musl|android|freebsd|web] [lite] [other_params]"
echo -e "Examples:"
echo -e " $0 dev"
echo -e " $0 dev lite"
echo -e " $0 dev docker"
echo -e " $0 dev docker lite"
echo -e " $0 release"
echo -e " $0 release lite"
echo -e " $0 release docker lite"
fi fi