diff --git a/.github/rename-go120.sh b/.github/rename-go120.sh new file mode 100644 index 00000000..136d74b5 --- /dev/null +++ b/.github/rename-go120.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +FILENAMES=$(ls) +for FILENAME in $FILENAMES +do + if [[ ! ($FILENAME =~ ".exe" || $FILENAME =~ ".sh")]];then + mc $FILENAME ${FILENAME}-go120 + elif [[ $FILENAME =~ ".exe" ]];then + mv $FILENAME ${FILENAME%.*}-go120.exe + else echo "skip $FILENAME" + fi +done \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index defd294b..df603041 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,8 @@ jobs: target: "darwin-amd64 darwin-arm64 android-arm64", id: "9", } + # Go 1.21 requires at least Windows 10 or Windows Server 2016; support for previous versions has been discontinued. + - { type: "WithoutCGO-GO120", target: "windows-amd64-compatible windows-amd64 windows-386",id: "10" } - { type: "WithCGO", target: "windows/*", id: "1" } - { type: "WithCGO", target: "linux/386", id: "2" } - { type: "WithCGO", target: "linux/amd64", id: "3" } @@ -126,18 +128,26 @@ jobs: shell: bash - name: Setup Go + if: ${{ matrix.job.type!='WithoutCGO-GO120' }} uses: actions/setup-go@v4 with: go-version: "1.21" check-latest: true + - name: Setup Go + if: ${{ matrix.job.type=='WithoutCGO-GO120' }} + uses: actions/setup-go@v4 + with: + go-version: "1.20" + check-latest: true + - name: Test if: ${{ matrix.job.id=='1' && matrix.job.type=='WithoutCGO' }} run: | go test ./... - name: Build WithoutCGO - if: ${{ matrix.job.type=='WithoutCGO' }} + if: ${{ matrix.job.type!='WithCGO' }} env: NAME: Clash.Meta BINDIR: bin @@ -185,6 +195,17 @@ jobs: ls -la cd .. + - name: Rename + if: ${{ matrix.job.type=='WithoutCGO-GO120' }} + run: | + cd bin + ls -la + cp ../.github/rename-go120.sh ./ + bash ./rename-go120.sh + rm ./rename-go120.sh + ls -la + cd .. + - name: Zip if: ${{ success() }} run: |