修改内核压缩方式
This commit is contained in:
144
.github/workflows/update_singbox_core.yaml
vendored
144
.github/workflows/update_singbox_core.yaml
vendored
@@ -3,11 +3,67 @@ name: Build Sing-Box Core for ShellCrash
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag1:
|
||||||
description: 'tag of sing-box, such as v1.7.8'
|
description: 'project name of sing-box, such as SagerNet/sing-box'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
tag2:
|
||||||
|
description: 'version of sing-box, such as v1.7.8'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
tag3:
|
||||||
|
description: 'build tags'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
jobs:
|
jobs:
|
||||||
|
go:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{steps.go.outputs.version}}
|
||||||
|
steps:
|
||||||
|
- name: get latest go version
|
||||||
|
id: go
|
||||||
|
run: |
|
||||||
|
echo version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
sing-box:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: go
|
||||||
|
env:
|
||||||
|
REPO: ${{ github.event.inputs.tag1 }}
|
||||||
|
TAGS: ${{ github.event.inputs.tag3 }}
|
||||||
|
outputs:
|
||||||
|
version: ${{steps.sing-box.outputs.version}}
|
||||||
|
tags: ${{steps.sing-box.outputs.tags}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.1.1
|
||||||
|
with:
|
||||||
|
repository: ${{ github.event.inputs.tag1 }}
|
||||||
|
ref: ${{ github.event.inputs.tag2 }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: setup go
|
||||||
|
uses: actions/setup-go@v4.1.0
|
||||||
|
with:
|
||||||
|
go-version: ${{needs.go.outputs.version}}
|
||||||
|
|
||||||
|
- name: get sing-box version
|
||||||
|
id: sing-box
|
||||||
|
run: |
|
||||||
|
git remote add sekai https://github.com/SagerNet/sing-box.git
|
||||||
|
git fetch --tags sekai
|
||||||
|
version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
|
||||||
|
[ -z "$version" ] && version=${{ github.event.inputs.tag2 }}
|
||||||
|
echo version=$version >> $GITHUB_OUTPUT
|
||||||
|
if [ -z "$TAGS" ];then
|
||||||
|
if [ "$REPO" = 'PuerNya/sing-box' ];then
|
||||||
|
echo tags=with_quic,with_shadowsocksr,with_ech,with_utls,with_reality_server,with_clash_api >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo tags=with_quic,with_ech,with_utls,with_reality_server,with_clash_api >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo tags=$TAGS >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
cross:
|
cross:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -46,6 +102,7 @@ jobs:
|
|||||||
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: sing-box
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
@@ -53,84 +110,73 @@ jobs:
|
|||||||
GOARM: ${{ matrix.goarm }}
|
GOARM: ${{ matrix.goarm }}
|
||||||
GOMIPS: ${{ matrix.gomips }}
|
GOMIPS: ${{ matrix.gomips }}
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
TAGS: with_quic,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
|
TAGS: ${{needs.sing-box.outputs.tags}}
|
||||||
|
VERSION: ${{needs.sing-box.outputs.version}}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sing-box
|
- name: Checkout sing-box
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||||
with:
|
with:
|
||||||
repository: SagerNet/sing-box
|
repository: ${{ github.event.inputs.tag1 }}
|
||||||
ref: ${{ github.event.inputs.tag }}
|
ref: ${{ github.event.inputs.tag2 }}
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- name: Get latest go version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ steps.version.outputs.go_version }}
|
go-version: ${{ steps.go.outputs.version }}
|
||||||
- name: Build
|
|
||||||
|
- name: build core
|
||||||
id: build
|
id: build
|
||||||
run: make
|
run: go build -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags "${TAGS}" ./cmd/sing-box
|
||||||
|
|
||||||
- name: Upload file to workspace
|
- name: Upload file to workspace
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
path: sing-box
|
path: sing-box
|
||||||
push_ShellCrash:
|
|
||||||
needs: cross
|
push_to_bin:
|
||||||
|
needs:
|
||||||
|
- cross
|
||||||
|
- sing-box
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
VERSION: ${{needs.sing-box.outputs.version}}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout ShellCrash
|
- name: Checkout ShellCrash
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||||
with:
|
with:
|
||||||
repository: juewuy/ShellCrash
|
repository: juewuy/ShellCrash
|
||||||
ref: dev
|
fetch-depth: 1
|
||||||
- name: Get upx
|
|
||||||
run: |
|
|
||||||
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
|
|
||||||
wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz
|
|
||||||
tar xf upx-3.96-amd64_linux.tar.xz
|
|
||||||
tar xf upx-3.93-amd64_linux.tar.xz
|
|
||||||
- name: Download file from workspace
|
- name: Download file from workspace
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: ./tmp
|
path: ./tmp
|
||||||
- name: Zip core by upx
|
|
||||||
|
- name: Zip core by tar
|
||||||
run: |
|
run: |
|
||||||
archs=(amd64 armv5 armv7 arm64 mips-softfloat mipsel-hardfloat mipsel-softfloat)
|
for arch in amd64 armv5 armv7 arm64 mips-softfloat mipsel-hardfloat mipsel-softfloat;do
|
||||||
new_name=(amd64 armv5 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat)
|
mv -f ./tmp/linux-${arch}/sing-box ./tmp/CrashCore
|
||||||
for((i=0;i<7;i++));do
|
chmod +x ./tmp/CrashCore
|
||||||
mv -f ./tmp/linux-${archs[i]}/sing-box ./tmp/singbox-linux-${new_name[i]}
|
tar --no-same-owner -zcvf ./tmp/singbox-linux-${arch}.tar.gz -C ./tmp CrashCore
|
||||||
chmod +x ./tmp/singbox-linux-${new_name[i]}
|
|
||||||
if [ "${archs[i]}" != "armv5" ];then
|
|
||||||
if [[ ${archs[i]} = mips* ]];then
|
|
||||||
./upx-3.93-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
|
|
||||||
else
|
|
||||||
./upx-3.96-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
rm -fr upx*
|
|
||||||
- name: Update
|
|
||||||
run: |
|
|
||||||
mkdir -p ./bin/singbox
|
|
||||||
rm -fr ./bin/singbox/*
|
|
||||||
mv -f ./tmp/singbox-linux-* ./bin/singbox/
|
|
||||||
rm -fr ./tmp
|
|
||||||
sed -i "s/singbox_v=.*/singbox_v=$(./bin/singbox/singbox-linux-amd64 version 2>/dev/null | grep -Eo 'version .*' | sed 's/version //')/" bin/version
|
|
||||||
- name: Commit and push
|
- name: Commit and push
|
||||||
run: |
|
run: |
|
||||||
|
[ "${{ github.event.inputs.tag1 }}" = SagerNet/sing-box ] && crashcore='singbox'
|
||||||
|
[ "${{ github.event.inputs.tag1 }}" = PuerNya/sing-box ] && crashcore='singboxp'
|
||||||
|
mkdir -p ./bin/${crashcore}
|
||||||
|
rm -fr ./bin/${crashcore}/*
|
||||||
|
mv -f ./tmp/singbox-linux-*.tar.gz ./bin/${crashcore}/
|
||||||
|
rm -fr ./tmp
|
||||||
|
sed -i "s/${crashcore}_v=.*/${crashcore}_v=${VERSION}/" ./bin/version
|
||||||
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"
|
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"
|
||||||
git add . && git commit -m "更新sing-box内核至${{ github.event.inputs.tag }}" || exit 0
|
git add . && git commit -m "更新${crashcore}内核至${VERSION}" || exit 0
|
||||||
git push
|
git push
|
||||||
|
|
||||||
- name: Cleanup Workflow
|
- name: Cleanup Workflow
|
||||||
uses: Mattraks/delete-workflow-runs@main
|
uses: Mattraks/delete-workflow-runs@main
|
||||||
with:
|
with:
|
||||||
retain_days: 1
|
retain_days: 1
|
||||||
keep_minimum_runs: 2
|
keep_minimum_runs: 2
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: sing-box-${{ matrix.name }}
|
|
||||||
path: sing-box*
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ jobs:
|
|||||||
for arch in amd64 armv5 armv7 arm64 mips-softfloat mipsel-hardfloat mipsel-softfloat;do
|
for arch in amd64 armv5 armv7 arm64 mips-softfloat mipsel-hardfloat mipsel-softfloat;do
|
||||||
mv -f ./tmp/linux-${arch}/sing-box ./tmp/CrashCore
|
mv -f ./tmp/linux-${arch}/sing-box ./tmp/CrashCore
|
||||||
chmod +x ./tmp/CrashCore
|
chmod +x ./tmp/CrashCore
|
||||||
tar -zcvf ./tmp/singbox-linux-${arch}.tar.gz -C ./tmp CrashCore
|
tar --no-same-owner -zcvf ./tmp/singbox-linux-${arch}.tar.gz -C ./tmp CrashCore
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Create Release and Upload Release Asset
|
- name: Create Release and Upload Release Asset
|
||||||
@@ -172,7 +172,6 @@ jobs:
|
|||||||
prerelease: true
|
prerelease: true
|
||||||
files: |
|
files: |
|
||||||
./tmp/singbox*
|
./tmp/singbox*
|
||||||
./tmp/version
|
|
||||||
|
|
||||||
- name: upload artifact
|
- name: upload artifact
|
||||||
if: ${{ env.RELEASE == '0' }}
|
if: ${{ env.RELEASE == '0' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user