Skip to content

Update sing-box-yelnoo #373

Update sing-box-yelnoo

Update sing-box-yelnoo #373

name: Update sing-box-yelnoo
on:
workflow_dispatch: # 保留手动触发
schedule:
- cron: "30 17 * * *" # 保留定时任务
push:
branches:
- latest # 仅监控latest分支
paths:
- ".github/workflows/sing-box-yelnoo.yaml" #
jobs:
go:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.go.outputs.version }}
steps:
- name: Get `Go` latest version
id: go
run: |
echo version=$(curl -sSL https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | jq -r 'map(.version) | sort_by(split(".") | map(tonumber)) | last') >> $GITHUB_OUTPUT
yelnoo:
runs-on: ubuntu-latest
needs: go
outputs:
yelnoo_version: ${{ steps.yelnoo.outputs.yelnoo_version }}
yelnoo_tags: ${{ steps.yelnoo.outputs.yelnoo_tags }}
yelnoo_time: ${{ steps.yelnoo.outputs.yelnoo_time }}
steps:
- name: Checkout `main`
uses: actions/checkout@v4
with:
repository: YelNoo/sing-box
ref: main
fetch-depth: 0
- name: Setup `Go`
uses: actions/setup-go@v5
with:
go-version: ${{ needs.go.outputs.version }}
- name: Get `sing-box YelNoo` version
id: yelnoo
run: |
git remote add sekai https://github.com/SagerNet/sing-box.git
git fetch --tags sekai
yelnoo_version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
echo "yelnoo_version=$yelnoo_version" >> $GITHUB_OUTPUT
echo yelnoo_tags=with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_utls,with_clash_api,with_gvisor >> $GITHUB_OUTPUT
yelnoo_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' $(echo "$yelnoo_version" | awk -F'-' '{print $3}'))
echo "yelnoo_time=$yelnoo_time" >> $GITHUB_OUTPUT
yelnoo_cross:
strategy:
matrix:
include:
# linux
- { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 }
- { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 }
- { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 }
- { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 }
- { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 }
- { name: linux-arm64, goos: linux, goarch: arm64 }
- { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat }
- { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat }
- { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat }
# windows
- { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 }
- { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 }
- { name: windows-arm64, goos: windows, goarch: arm64 }
fail-fast: false
runs-on: ubuntu-latest
needs:
- go
- yelnoo
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOAMD64: ${{ matrix.goamd64 }}
GOARM: ${{ matrix.goarm }}
GOMIPS: ${{ matrix.gomips }}
CGO_ENABLED: 0
yelnoo_TAGS: ${{ needs.yelnoo.outputs.yelnoo_tags }}
yelnoo_VERSION: ${{ needs.yelnoo.outputs.yelnoo_version }}
steps:
- name: Checkout `main`
uses: actions/checkout@v4
with:
repository: YelNoo/sing-box
ref: main
- name: Setup `Go`
uses: actions/setup-go@v5
with:
go-version: ${{ needs.go.outputs.version }}
- name: Build `sing-box YelNoo` core
id: main
run: go build -v -trimpath -ldflags "-checklinkname=0 -X 'github.com/sagernet/sing-box/constant.Version=${yelnoo_VERSION}' -s -w -buildid=" -tags "${yelnoo_TAGS}" ./cmd/sing-box
- name: Upload files to workspace
uses: actions/upload-artifact@v4
with:
name: sing-box-yelnoo-${{ matrix.name }}
path: sing-box*
compression-level: 9
yelnoo_dev:
runs-on: ubuntu-latest
needs: go
outputs:
yelnoo_dev_version: ${{ steps.yelnoo_dev.outputs.yelnoo_dev_version }}
yelnoo_dev_tags: ${{ steps.yelnoo_dev.outputs.yelnoo_dev_tags }}
yelnoo_dev_time: ${{ steps.yelnoo_dev.outputs.yelnoo_dev_time }}
steps:
- name: Checkout `dev`
uses: actions/checkout@v4
with:
repository: YelNoo/sing-box
ref: dev
fetch-depth: 0
- name: Setup `Go`
uses: actions/setup-go@v5
with:
go-version: ${{ needs.go.outputs.version }}
- name: Get `sing-box YelNoo` version
id: yelnoo_dev
run: |
git remote add sekai https://github.com/SagerNet/sing-box.git
git fetch --tags sekai
yelnoo_dev_version=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
echo "yelnoo_dev_version=$yelnoo_dev_version" >> $GITHUB_OUTPUT
echo yelnoo_dev_tags=with_quic,with_dhcp,with_wireguard,with_shadowsocksr,with_utls,with_clash_api,with_gvisor >> $GITHUB_OUTPUT
yelnoo_dev_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' $(echo "$yelnoo_dev_version" | awk -F'-' '{print $3}'))
echo "yelnoo_dev_time=$yelnoo_dev_time" >> $GITHUB_OUTPUT
yelnoo_dev_cross:
strategy:
matrix:
include:
# linux
- { name: linux-amd64, goos: linux, goarch: amd64, goamd64: v1 }
- { name: linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3 }
- { name: linux-armv5, goos: linux, goarch: arm, goarm: 5 }
- { name: linux-armv6, goos: linux, goarch: arm, goarm: 6 }
- { name: linux-armv7, goos: linux, goarch: arm, goarm: 7 }
- { name: linux-arm64, goos: linux, goarch: arm64 }
- { name: linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat }
- { name: linux-mipsle-softfloat, goos: linux, goarch: mipsle, gomips: softfloat }
- { name: linux-mipsle-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat }
# windows
- { name: windows-amd64, goos: windows, goarch: amd64, goamd64: v1 }
- { name: windows-amd64-v3, goos: windows, goarch: amd64, goamd64: v3 }
- { name: windows-arm64, goos: windows, goarch: arm64 }
fail-fast: false
runs-on: ubuntu-latest
needs:
- go
- yelnoo_dev
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOAMD64: ${{ matrix.goamd64 }}
GOARM: ${{ matrix.goarm }}
GOMIPS: ${{ matrix.gomips }}
CGO_ENABLED: 0
yelnoo_dev_TAGS: ${{ needs.yelnoo_dev.outputs.yelnoo_dev_tags }}
yelnoo_dev_VERSION: ${{ needs.yelnoo_dev.outputs.yelnoo_dev_version }}
steps:
- name: Checkout `build`
uses: actions/checkout@v4
with:
repository: YelNoo/sing-box
ref: dev
- name: Setup `Go`
uses: actions/setup-go@v5
with:
go-version: ${{ needs.go.outputs.version }}
- name: Build `sing-box YelNoo-dev` core
id: dev
run: go build -v -trimpath -ldflags "-checklinkname=0 -X 'github.com/sagernet/sing-box/constant.Version=${yelnoo_dev_VERSION}' -s -w -buildid=" -tags "${yelnoo_dev_TAGS}" ./cmd/sing-box
- name: Upload files to workspace
uses: actions/upload-artifact@v4
with:
name: sing-box-yelnoo-dev-${{ matrix.name }}
path: sing-box*
compression-level: 9
push_sing-box:
needs:
- yelnoo_cross
- yelnoo
- yelnoo_dev_cross
- yelnoo_dev
runs-on: ubuntu-latest
env:
yelnoo_VERSION: ${{ needs.yelnoo.outputs.yelnoo_version }}
yelnoo_TIME: ${{ needs.yelnoo.outputs.yelnoo_time }}
yelnoo_dev_VERSION: ${{ needs.yelnoo_dev.outputs.yelnoo_dev_version }}
yelnoo_dev_TIME: ${{ needs.yelnoo_dev.outputs.yelnoo_dev_time }}
steps:
- name: Clone Repository
uses: actions/checkout@main
- name: Download files from workspace
uses: actions/download-artifact@v4
with:
path: ./tmp-sing-box/
- name: Zip `sing-box` cores by `tar`
run: |
mkdir -p ./tmp-sing-box/compress/
archs=(amd64 amd64-v3 armv5 armv6 armv7 arm64 mips-softfloat mipsle-hardfloat mipsle-softfloat)
new_name=(amd64 amd64v3 armv5 armv6 armv7 arm64 mips-softfloat mipsle-hardfloat mipsle-softfloat)
# `YelNoo` cores
for ((i = 0; i < 9; i++)); do
mv -f "./tmp-sing-box/sing-box-yelnoo-linux-${archs[i]}/sing-box" ./tmp-sing-box/sing-box
chmod +x ./tmp-sing-box/sing-box
tar --no-same-owner -czf "./tmp-sing-box/compress/sing-box-yelnoo-linux-${new_name[i]}.tar.gz" -C ./tmp-sing-box/ ./sing-box
done
# `YelNoo-dev` cores
for ((i = 0; i < 9; i++)); do
mv -f "./tmp-sing-box/sing-box-yelnoo-dev-linux-${archs[i]}/sing-box" ./tmp-sing-box/sing-box
chmod +x ./tmp-sing-box/sing-box
tar --no-same-owner -czf "./tmp-sing-box/compress/sing-box-yelnoo-dev-linux-${new_name[i]}.tar.gz" -C ./tmp-sing-box/ ./sing-box
done
- name: Move `sing-box` cores
run: |
mkdir -p ./sing-box/
mv -f ./tmp-sing-box/compress/* ./sing-box/
# `YelNoo` cores for Windows
mv -f ./tmp-sing-box/sing-box-yelnoo-windows-amd64/sing-box.exe ./sing-box/sing-box-yelnoo-windows-amd64.exe
mv -f ./tmp-sing-box/sing-box-yelnoo-windows-amd64-v3/sing-box.exe ./sing-box/sing-box-yelnoo-windows-amd64v3.exe
mv -f ./tmp-sing-box/sing-box-yelnoo-windows-arm64/sing-box.exe ./sing-box/sing-box-yelnoo-windows-arm64.exe
# `YelNoo-dev` cores for Windows
mv -f ./tmp-sing-box/sing-box-yelnoo-dev-windows-amd64/sing-box.exe ./sing-box/sing-box-yelnoo-dev-windows-amd64.exe
mv -f ./tmp-sing-box/sing-box-yelnoo-dev-windows-amd64-v3/sing-box.exe ./sing-box/sing-box-yelnoo-dev-windows-amd64v3.exe
mv -f ./tmp-sing-box/sing-box-yelnoo-dev-windows-arm64/sing-box.exe ./sing-box/sing-box-yelnoo-dev-windows-arm64.exe
- name: Release and upload `sing-box` assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: sing-box-yelnoo
tag: sing-box-yelnoo
overwrite: true
body: |
更新 [sing-box YelNoo 版](https://github.com/YelNoo/sing-box/tree/build)至 v${{ env.yelnoo_VERSION }},发布于 ${{ env.yelnoo_TIME }}
更新 [sing-box YelNoo-dev 版](https://github.com/YelNoo/sing-box/tree/build)至 v${{ env.yelnoo_dev_VERSION }},发布于 ${{ env.yelnoo_dev_TIME }}
file_glob: true
file: ./sing-box/*