Skip to content

Commit

Permalink
ci: split release actions
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 3, 2023
1 parent f6ab1f7 commit 3c66db9
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release_linux_musl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release_linux_musl

on:
release:
types: [ published ]

jobs:
release_linux_musl:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ '1.20' ]
name: Release
runs-on: ${{ matrix.platform }}
steps:

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build
run: |
bash build.sh release linux_musl
- name: Upload assets
uses: softprops/action-gh-release@v1
with:
files: build/compress/*
2 changes: 1 addition & 1 deletion .github/workflows/release_linux_musl_arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [ published ]

jobs:
release_arm:
release_linux_musl_arm:
strategy:
matrix:
platform: [ ubuntu-latest ]
Expand Down
22 changes: 15 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ BuildDocker() {
}

BuildRelease() {
rm -rf .git/
mkdir -p "build"
BuildWinArm64 ./build/alist-windows-arm64.exe
xgo -out "$appName" -ldflags="$ldflags" -tags=jsoniter .
# why? Because some target platforms seem to have issues with upx compression
upx -9 ./alist-linux-amd64
cp ./alist-windows-amd64.exe ./alist-windows-amd64-upx.exe
upx -9 ./alist-windows-amd64-upx.exe
mv alist-* build
}

BuildReleaseLinuxMusl() {
rm -rf .git/
mkdir -p "build"
muslflags="--extldflags '-static -fpic' $ldflags"
Expand All @@ -112,13 +124,6 @@ BuildRelease() {
export CGO_ENABLED=1
go build -o ./build/$appName-$os_arch -ldflags="$muslflags" -tags=jsoniter .
done
BuildWinArm64 ./build/alist-windows-arm64.exe
xgo -out "$appName" -ldflags="$ldflags" -tags=jsoniter .
# why? Because some target platforms seem to have issues with upx compression
upx -9 ./alist-linux-amd64
cp ./alist-windows-amd64.exe ./alist-windows-amd64-upx.exe
upx -9 ./alist-windows-amd64-upx.exe
mv alist-* build
}

BuildReleaseLinuxMuslArm() {
Expand Down Expand Up @@ -192,6 +197,9 @@ elif [ "$1" = "release" ]; then
elif [ "$2" = "linux_musl_arm" ]; then
BuildReleaseLinuxMuslArm
MakeRelease "md5-linux-musl-arm.txt"
elif [ "$2" = "linux_musl" ]; then
BuildReleaseLinuxMusl
MakeRelease "md5-linux-musl.txt"
else
BuildRelease
MakeRelease "md5.txt"
Expand Down

0 comments on commit 3c66db9

Please sign in to comment.