mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 06:53:13 +08:00
chore: Update workflow
This commit is contained in:
parent
8d9eb1e534
commit
78b4b11f26
17
.github/mihomo.service
vendored
Normal file
17
.github/mihomo.service
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=mihomo Daemon, Another Clash Kernel.
|
||||||
|
After=network.target NetworkManager.service systemd-networkd.service iwd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
LimitNPROC=500
|
||||||
|
LimitNOFILE=1000000
|
||||||
|
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
|
||||||
|
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
|
||||||
|
Restart=always
|
||||||
|
ExecStartPre=/usr/bin/sleep 2s
|
||||||
|
ExecStart=/usr/local/bin/mihomo -d /etc/mihomo
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
488
.github/workflows/build.yml
vendored
488
.github/workflows/build.yml
vendored
@ -21,314 +21,288 @@ concurrency:
|
|||||||
env:
|
env:
|
||||||
REGISTRY: docker.io
|
REGISTRY: docker.io
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
build:
|
||||||
permissions: write-all
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
job:
|
jobs:
|
||||||
- {
|
- { goos: darwin, goarch: arm64, output: arm64 }
|
||||||
type: "WithoutCGO",
|
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64-compatible }
|
||||||
target: "linux-amd64 linux-amd64-compatible",
|
- { goos: darwin, goarch: amd64, goamd64: v3, output: amd64 }
|
||||||
id: "1",
|
|
||||||
}
|
- { goos: linux, goarch: '386', output: '386' }
|
||||||
- {
|
- { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible }
|
||||||
type: "WithoutCGO",
|
- { goos: linux, goarch: amd64, goamd64: v3, output: amd64 }
|
||||||
target: "linux-armv5 linux-armv6 linux-armv7",
|
- { goos: linux, goarch: arm64, output: arm64 }
|
||||||
id: "2",
|
- { goos: linux, goarch: arm, goarm: '7', output: armv7 }
|
||||||
}
|
- { goos: linux, goarch: mips, mips: hardfloat, output: mips-hardfloat }
|
||||||
- {
|
- { goos: linux, goarch: mips, mips: softfloat, output: mips-softfloat }
|
||||||
type: "WithoutCGO",
|
- { goos: linux, goarch: mipsle, mips: hardfloat, output: mipsle-hardfloat }
|
||||||
target: "linux-arm64 linux-mips64 linux-mips64le",
|
- { goos: linux, goarch: mipsle, mips: softfloat, output: mipsle-softfloat }
|
||||||
id: "3",
|
- { goos: linux, goarch: mips64, output: mips64 }
|
||||||
}
|
- { goos: linux, goarch: mips64le, output: mips64le }
|
||||||
- {
|
- { goos: linux, goarch: loong64, output: loong64 }
|
||||||
type: "WithoutCGO",
|
- { goos: linux, goarch: riscv64, output: riscv64 }
|
||||||
target: "linux-mips-softfloat linux-mips-hardfloat linux-mipsle-softfloat linux-mipsle-hardfloat",
|
- { goos: linux, goarch: s390x, output: s390x }
|
||||||
id: "4",
|
|
||||||
}
|
- { goos: windows, goarch: '386', output: '386' }
|
||||||
- { type: "WithoutCGO", target: "linux-386 linux-riscv64 linux-loong64", id: "5" }
|
- { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible }
|
||||||
- {
|
- { goos: windows, goarch: amd64, goamd64: v3, output: amd64 }
|
||||||
type: "WithoutCGO",
|
- { goos: windows, goarch: arm, goarm: '7', output: armv7 }
|
||||||
target: "freebsd-386 freebsd-amd64 freebsd-arm64",
|
- { goos: windows, goarch: arm64, output: arm64 }
|
||||||
id: "6",
|
|
||||||
}
|
- { goos: freebsd, goarch: '386', output: '386' }
|
||||||
- {
|
- { goos: freebsd, goarch: amd64, goamd64: v1, output: amd64-compatible }
|
||||||
type: "WithoutCGO",
|
- { goos: freebsd, goarch: amd64, goamd64: v3, output: amd64 }
|
||||||
target: "windows-amd64-compatible windows-amd64 windows-386",
|
- { goos: freebsd, goarch: arm64, output: arm64 }
|
||||||
id: "7",
|
|
||||||
}
|
- { goos: android, goarch: '386', ndk: i686-linux-android34, output: '386' }
|
||||||
- {
|
- { goos: android, goarch: amd64, ndk: x86_64-linux-android34, output: amd64 }
|
||||||
type: "WithoutCGO",
|
- { goos: android, goarch: arm, ndk: armv7a-linux-androideabi34, output: armv7 }
|
||||||
target: "windows-arm64 windows-arm32v7",
|
- { goos: android, goarch: arm64, ndk: aarch64-linux-android34, output: arm64-v8 }
|
||||||
id: "8",
|
|
||||||
}
|
- { goos: windows, goarch: '386', output: '386-go120', version: 20 }
|
||||||
- {
|
- { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, version: 20 }
|
||||||
type: "WithoutCGO",
|
- { goos: windows, goarch: amd64, goamd64: v3, output: amd64-go120, version: 20 }
|
||||||
target: "darwin-amd64 darwin-arm64",
|
|
||||||
id: "9",
|
- { goos: darwin, goarch: arm64, output: arm64-go120, version: 20 }
|
||||||
}
|
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, version: 20 }
|
||||||
- {
|
- { goos: darwin, goarch: amd64, goamd64: v3, output: amd64-go120, version: 20 }
|
||||||
type: "WithoutCGO",
|
|
||||||
target: "darwin-amd64-compatible android-arm64",
|
- { goos: linux, goarch: '386', output: '386-go120', version: 20 }
|
||||||
id: "10",
|
- { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, version: 20 }
|
||||||
}
|
- { goos: linux, goarch: amd64, goamd64: v3, output: amd64-go120, version: 20 }
|
||||||
# only for test
|
|
||||||
- { type: "WithoutCGO-GO120", target: "linux-amd64 linux-amd64-compatible",id: "1" }
|
|
||||||
# Go 1.20 is the last release that will run on any release of Windows 7, 8, Server 2008 and Server 2012. Go 1.21 will require at least Windows 10 or Server 2016.
|
|
||||||
- { type: "WithoutCGO-GO120", target: "windows-amd64-compatible windows-amd64 windows-386",id: "2" }
|
|
||||||
# Go 1.20 is the last release that will run on macOS 10.13 High Sierra or 10.14 Mojave. Go 1.21 will require macOS 10.15 Catalina or later.
|
|
||||||
- { type: "WithoutCGO-GO120", target: "darwin-amd64 darwin-arm64",id: "3" }
|
|
||||||
- { type: "WithoutCGO-GO120", target: "darwin-amd64-compatible android-arm64",id: "4" }
|
|
||||||
# - { type: "WithCGO", target: "windows/*", id: "1" }
|
|
||||||
# - { type: "WithCGO", target: "linux/386", id: "2" }
|
|
||||||
# - { type: "WithCGO", target: "linux/amd64", id: "3" }
|
|
||||||
# - { type: "WithCGO", target: "linux/arm64,linux/riscv64", id: "4" }
|
|
||||||
# - { type: "WithCGO", target: "linux/arm,", id: "5" }
|
|
||||||
# - { type: "WithCGO", target: "linux/arm-6,linux/arm-7", id: "6" }
|
|
||||||
# - { type: "WithCGO", target: "linux/mips,linux/mipsle", id: "7" }
|
|
||||||
# - { type: "WithCGO", target: "linux/mips64", id: "8" }
|
|
||||||
# - { type: "WithCGO", target: "linux/mips64le", id: "9" }
|
|
||||||
# - { type: "WithCGO", target: "darwin-10.16/*", id: "10" }
|
|
||||||
# - { type: "WithCGO", target: "android", id: "11" }
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the Go module directory
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set variables
|
- name: Set up Go1.22
|
||||||
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
if: ${{ matrix.jobs.version != '20' }}
|
||||||
shell: bash
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ^1.22
|
||||||
|
|
||||||
- name: Set variables
|
- name: Set up Go1.20
|
||||||
if: ${{github.ref_name=='Alpha'}}
|
if: ${{ matrix.jobs.version == '20' }}
|
||||||
run: echo "VERSION=alpha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
uses: actions/setup-go@v5
|
||||||
shell: bash
|
with:
|
||||||
|
go-version: ^1.20
|
||||||
|
|
||||||
- name: Set variables
|
- name: Set variables
|
||||||
if: ${{github.ref_name=='Meta'}}
|
if: ${{github.ref_name=='Alpha'}}
|
||||||
run: echo "VERSION=meta-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
run: echo "VERSION=alpha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set variables
|
- name: Set variables
|
||||||
if: ${{github.ref_name=='' || github.ref_type=='tag'}}
|
if: ${{github.ref_name=='' || github.ref_type=='tag'}}
|
||||||
run: echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV
|
run: echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set ENV
|
- name: Set Time Variable
|
||||||
run: |
|
run: |
|
||||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
|
||||||
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
|
echo "CGO_ENABLED=0" >> $GITHUB_ENV
|
||||||
shell: bash
|
echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set ENV
|
- name: Setup NDK
|
||||||
run: |
|
if: ${{ matrix.jobs.goos == 'android' }}
|
||||||
echo "TAGS=with_gvisor" >> $GITHUB_ENV
|
uses: nttld/setup-ndk@v1
|
||||||
echo "LDFLAGS=-X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid=" >> $GITHUB_ENV
|
id: setup-ndk
|
||||||
echo "GOTOOLCHAIN=local" >> $GITHUB_ENV
|
with:
|
||||||
shell: bash
|
ndk-version: r26c
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Set NDK path
|
||||||
if: ${{ matrix.job.type!='WithoutCGO-GO120' }}
|
if: ${{ matrix.jobs.goos == 'android' }}
|
||||||
uses: actions/setup-go@v5
|
run: |
|
||||||
with:
|
echo "CC=${{steps.setup-ndk.outputs.ndk-path}}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{matrix.jobs.ndk}}-clang" >> $GITHUB_ENV
|
||||||
go-version: "1.22"
|
echo "CGO_ENABLED=1" >> $GITHUB_ENV
|
||||||
check-latest: true
|
echo "BUILDTAG=" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup Go
|
- name: build core
|
||||||
if: ${{ matrix.job.type=='WithoutCGO-GO120' }}
|
env:
|
||||||
uses: actions/setup-go@v5
|
GOOS: ${{matrix.jobs.goos}}
|
||||||
with:
|
GOARCH: ${{matrix.jobs.goarch}}
|
||||||
go-version: "1.20"
|
GOAMD64: ${{matrix.jobs.goamd64}}
|
||||||
check-latest: true
|
GOARM: ${{matrix.jobs.arm}}
|
||||||
|
GOMIPS: ${{matrix.jobs.mips}}
|
||||||
|
run: |
|
||||||
|
echo $CGO_ENABLED
|
||||||
|
go build -v -tags "with_gvisor" -trimpath -ldflags "${BUILDTAG} -X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid="
|
||||||
|
if [ "${{matrix.jobs.goos}}" = "windows" ]; then
|
||||||
|
cp mihomo.exe mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
|
||||||
|
zip -r mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.zip mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
|
||||||
|
else
|
||||||
|
cp mihomo mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
|
||||||
|
gzip -c mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}} > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.gz
|
||||||
|
rm mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Test
|
- name: Create DEB package
|
||||||
if: ${{ matrix.job.id=='1' && matrix.job.type!='WithCGO' }}
|
if: ${{ matrix.jobs.goos == 'linux' && !contains(matrix.jobs.goarch, 'mips') }}
|
||||||
run: |
|
run: |
|
||||||
go test ./...
|
sudo apt-get install dpkg
|
||||||
|
|
||||||
- name: Build WithoutCGO
|
mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/DEBIAN
|
||||||
if: ${{ matrix.job.type!='WithCGO' }}
|
mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/bin
|
||||||
env:
|
mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/mihomo
|
||||||
NAME: mihomo
|
mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/systemd/system/
|
||||||
BINDIR: bin
|
mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/share/licenses/mihomo
|
||||||
run: make -j$(($(nproc) + 1)) ${{ matrix.job.target }}
|
|
||||||
|
|
||||||
- uses: nttld/setup-ndk@v1
|
cp mihomo mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/bin/mihomo
|
||||||
if: ${{ matrix.job.type=='WithCGO' && matrix.job.target=='android' }}
|
cp LICENSE mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/share/licenses/mihomo/
|
||||||
id: setup-ndk
|
cp .github/mihomo.service mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/systemd/system/
|
||||||
with:
|
|
||||||
ndk-version: r26b
|
|
||||||
add-to-path: true
|
|
||||||
|
|
||||||
- name: Build Android
|
cat > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/mihomo/config.yaml <<EOF
|
||||||
if: ${{ matrix.job.type=='WithCGO' && matrix.job.target=='android' }}
|
mixed-port: 7890
|
||||||
env:
|
external-controller: 127.0.0.1:9090
|
||||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
EOF
|
||||||
run: |
|
|
||||||
mkdir bin
|
|
||||||
CC=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang
|
|
||||||
CGO_ENABLED=1 CC=${CC} GOARCH=arm64 GOOS=android go build -tags ${TAGS} -trimpath -ldflags "${LDFLAGS}" -o bin/${NAME}-android-arm64
|
|
||||||
|
|
||||||
- name: Set up xgo
|
cat > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/DEBIAN/control <<EOF
|
||||||
if: ${{ matrix.job.type=='WithCGO' && matrix.job.target!='android' }}
|
Package: mihomo
|
||||||
run: |
|
Version: 1.18.2-${VERSION}
|
||||||
docker pull techknowlogick/xgo:latest
|
Section:
|
||||||
go install src.techknowlogick.com/xgo@latest
|
Priority: extra
|
||||||
|
Architecture: ${{matrix.jobs.goarch}}
|
||||||
|
Maintainer: MetaCubeX <none@example.com>
|
||||||
|
Homepage: https://wiki.metacubex.one/
|
||||||
|
Description: The universal proxy platform.
|
||||||
|
EOF
|
||||||
|
|
||||||
- name: Build by xgo
|
dpkg-deb -Z gzip --build mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}
|
||||||
if: ${{ matrix.job.type=='WithCGO' && matrix.job.target!='android' }}
|
|
||||||
env:
|
|
||||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
|
||||||
run: |
|
|
||||||
mkdir bin
|
|
||||||
xgo --targets="${{ matrix.job.target }}" --tags="${TAGS}" -ldflags="${LDFLAGS}" --out bin/${NAME} ./
|
|
||||||
|
|
||||||
- name: Rename
|
- name: Convert DEB to RPM
|
||||||
if: ${{ matrix.job.type=='WithCGO' }}
|
if: ${{ matrix.jobs.goos == 'linux' && !contains(matrix.jobs.goarch, 'mips') }}
|
||||||
run: |
|
run: |
|
||||||
cd bin
|
sudo apt-get install -y alien
|
||||||
ls -la
|
alien --to-rpm --scripts mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.deb
|
||||||
cp ../.github/rename-cgo.sh ./
|
mv mihomo*.rpm mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.rpm
|
||||||
bash ./rename-cgo.sh
|
|
||||||
rm ./rename-cgo.sh
|
|
||||||
ls -la
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Rename
|
- name: Convert DEB to PKG
|
||||||
if: ${{ matrix.job.type=='WithoutCGO-GO120' }}
|
if: ${{ matrix.jobs.goos == 'linux' && !contains(matrix.jobs.goarch, 'mips') }}
|
||||||
run: |
|
run: |
|
||||||
cd bin
|
docker pull archlinux
|
||||||
ls -la
|
docker run --rm -v ./:/mnt archlinux bash -c "
|
||||||
cp ../.github/rename-go120.sh ./
|
pacman -Syu pkgfile base-devel --noconfirm
|
||||||
bash ./rename-go120.sh
|
curl -L https://github.com/helixarch/debtap/raw/master/debtap > /usr/bin/debtap
|
||||||
rm ./rename-go120.sh
|
chmod 755 /usr/bin/debtap
|
||||||
ls -la
|
debtap -u
|
||||||
cd ..
|
debtap -Q /mnt/mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.deb
|
||||||
|
"
|
||||||
|
mv mihomo*.pkg.tar.zst mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.pkg.tar.zst
|
||||||
|
|
||||||
- name: Zip
|
- name: Save version
|
||||||
if: ${{ success() }}
|
run: |
|
||||||
run: |
|
echo ${VERSION} > version.txt
|
||||||
cd bin
|
shell: bash
|
||||||
ls -la
|
|
||||||
chmod +x *
|
|
||||||
cp ../.github/release.sh ./
|
|
||||||
bash ./release.sh
|
|
||||||
rm ./release.sh
|
|
||||||
ls -la
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Save version
|
- name: Archive production artifacts
|
||||||
run: echo ${VERSION} > bin/version.txt
|
uses: actions/upload-artifact@v4
|
||||||
shell: bash
|
with:
|
||||||
|
name: ${{ matrix.jobs.goos }}-${{ matrix.jobs.output }}
|
||||||
- uses: actions/upload-artifact@v4
|
path: |
|
||||||
if: ${{ success() }}
|
mihomo*.gz
|
||||||
with:
|
mihomo*.deb
|
||||||
name: artifact-${{ matrix.job.type }}-${{ matrix.job.target }}
|
mihomo*.rpm
|
||||||
path: bin/
|
mihomo*.pkg.tar.zst
|
||||||
|
mihomo*.zip
|
||||||
|
version.txt
|
||||||
|
|
||||||
Upload-Prerelease:
|
Upload-Prerelease:
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
if: ${{ github.ref_type == 'branch' && !startsWith(github.event_name, 'pull_request') }}
|
if: ${{ github.ref_type == 'branch' && !startsWith(github.event_name, 'pull_request') }}
|
||||||
needs: [Build]
|
needs: [build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v4
|
- name: Download all workflow run artifacts
|
||||||
with:
|
uses: actions/download-artifact@v4
|
||||||
path: bin/
|
with:
|
||||||
merge-multiple: true
|
path: bin/
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Display structure of downloaded files
|
- name: Delete current release assets
|
||||||
run: ls -R
|
uses: 8Mi-Tech/delete-release-assets-action@main
|
||||||
working-directory: bin
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: Prerelease-${{ github.ref_name }}
|
||||||
|
deleteOnlyFromDrafts: false
|
||||||
|
- name: Set Env
|
||||||
|
run: |
|
||||||
|
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Delete current release assets
|
- name: Tag Repo
|
||||||
uses: 8Mi-Tech/delete-release-assets-action@main
|
uses: richardsimko/update-tag@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
tag_name: Prerelease-${{ github.ref_name }}
|
||||||
tag: Prerelease-${{ github.ref_name }}
|
env:
|
||||||
deleteOnlyFromDrafts: false
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set Env
|
|
||||||
run: |
|
|
||||||
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Tag Repo
|
|
||||||
uses: richardsimko/update-tag@v1
|
|
||||||
with:
|
|
||||||
tag_name: Prerelease-${{ github.ref_name }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
cat > release.txt << 'EOF'
|
cat > release.txt << 'EOF'
|
||||||
Release created at ${{ env.BUILDTIME }}
|
Release created at ${{ env.BUILDTIME }}
|
||||||
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
|
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
|
||||||
<br>
|
<br>
|
||||||
[我应该下载哪个文件? / Which file should I download?](https://github.com/MetaCubeX/mihomo/wiki/FAQ)
|
[我应该下载哪个文件? / Which file should I download?](https://github.com/MetaCubeX/mihomo/wiki/FAQ)
|
||||||
[二进制文件筛选 / Binary file selector](https://metacubex.github.io/Meta-Docs/startup/#_1)
|
[二进制文件筛选 / Binary file selector](https://metacubex.github.io/Meta-Docs/startup/#_1)
|
||||||
[查看文档 / Docs](https://metacubex.github.io/Meta-Docs/)
|
[查看文档 / Docs](https://metacubex.github.io/Meta-Docs/)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Upload Prerelease
|
- name: Upload Prerelease
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
with:
|
with:
|
||||||
tag_name: Prerelease-${{ github.ref_name }}
|
tag_name: Prerelease-${{ github.ref_name }}
|
||||||
files: |
|
files: |
|
||||||
bin/*
|
bin/*
|
||||||
prerelease: true
|
prerelease: true
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
body_path: release.txt
|
body_path: release.txt
|
||||||
|
|
||||||
Upload-Release:
|
Upload-Release:
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
if: ${{ github.ref_type=='tag' }}
|
if: ${{ github.ref_type=='tag' }}
|
||||||
needs: [Build]
|
needs: [build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get tags
|
- name: Get tags
|
||||||
run: |
|
run: |
|
||||||
echo "CURRENTVERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
echo "CURRENTVERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
git fetch --tags
|
git fetch --tags
|
||||||
echo "PREVERSION=$(git describe --tags --abbrev=0 HEAD^)" >> $GITHUB_ENV
|
echo "PREVERSION=$(git describe --tags --abbrev=0 HEAD^)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Generate release notes
|
- name: Generate release notes
|
||||||
run: |
|
run: |
|
||||||
cp ./.github/genReleaseNote.sh ./
|
cp ./.github/genReleaseNote.sh ./
|
||||||
bash ./genReleaseNote.sh -v ${PREVERSION}...${CURRENTVERSION}
|
bash ./genReleaseNote.sh -v ${PREVERSION}...${CURRENTVERSION}
|
||||||
rm ./genReleaseNote.sh
|
rm ./genReleaseNote.sh
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: bin/
|
path: bin/
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
run: ls -R
|
run: ls -R
|
||||||
working-directory: bin
|
working-directory: bin
|
||||||
|
|
||||||
- name: Upload Release
|
- name: Upload Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref_name }}
|
tag_name: ${{ github.ref_name }}
|
||||||
files: bin/*
|
files: bin/*
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
body_path: release.md
|
body_path: release.md
|
||||||
|
|
||||||
Docker:
|
Docker:
|
||||||
if: ${{ !startsWith(github.event_name, 'pull_request') }}
|
if: ${{ !startsWith(github.event_name, 'pull_request') }}
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
needs: [Build]
|
needs: [build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -12,7 +12,7 @@ COPY docker/file-name.sh /mihomo/file-name.sh
|
|||||||
WORKDIR /mihomo
|
WORKDIR /mihomo
|
||||||
COPY bin/ bin/
|
COPY bin/ bin/
|
||||||
RUN FILE_NAME=`sh file-name.sh` && echo $FILE_NAME && \
|
RUN FILE_NAME=`sh file-name.sh` && echo $FILE_NAME && \
|
||||||
FILE_NAME=`ls bin/ | egrep "$FILE_NAME.*"|awk NR==1` && echo $FILE_NAME && \
|
FILE_NAME=`ls bin/ | egrep "$FILE_NAME.gz"|awk NR==1` && echo $FILE_NAME && \
|
||||||
mv bin/$FILE_NAME mihomo.gz && gzip -d mihomo.gz && echo "$FILE_NAME" > /mihomo-config/test
|
mv bin/$FILE_NAME mihomo.gz && gzip -d mihomo.gz && echo "$FILE_NAME" > /mihomo-config/test
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
LABEL org.opencontainers.image.source="https://github.com/MetaCubeX/mihomo"
|
LABEL org.opencontainers.image.source="https://github.com/MetaCubeX/mihomo"
|
||||||
|
Loading…
Reference in New Issue
Block a user