已修改 .github/workflows/test.yaml
This commit is contained in:
23
.github/workflows/test.yaml
vendored
23
.github/workflows/test.yaml
vendored
@@ -95,10 +95,24 @@ jobs:
|
|||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{needs.go.outputs.version}}
|
go-version: ${{needs.go.outputs.version}}
|
||||||
|
- name: Set variables
|
||||||
|
run: |
|
||||||
|
VERSION="${GITHUB_REF_NAME,,}-$(git rev-parse --short HEAD)"
|
||||||
|
VERSION="${VERSION//\//-}"
|
||||||
|
PackageVersion="$(curl -s "https://api.github.com/repos/MetaCubeX/mihomo/releases/latest" | jq -r '.tag_name' | sed 's/v//g' | awk -F '.' '{$NF = $NF + 1; print}' OFS='.').${VERSION/-/.}"
|
||||||
|
if [ -n "${{ github.event.inputs.version }}" ]; then
|
||||||
|
VERSION=${{ github.event.inputs.version }}
|
||||||
|
PackageVersion="${VERSION#v}"
|
||||||
|
fi
|
||||||
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
echo "PackageVersion=${PackageVersion}" >> $GITHUB_ENV
|
||||||
|
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
|
||||||
|
echo "CGO_ENABLED=0" >> $GITHUB_ENV
|
||||||
|
echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV
|
||||||
|
echo "GOTOOLCHAIN=local" >> $GITHUB_ENV
|
||||||
- name: Set ENV
|
- name: Set ENV
|
||||||
run: |
|
run: |
|
||||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
sudo timedatectl set-timezone "Asia/Shanghai"
|
||||||
@@ -114,8 +128,9 @@ jobs:
|
|||||||
|
|
||||||
- name: build core
|
- name: build core
|
||||||
id: build
|
id: build
|
||||||
run: go build -v -trimpath -ldflags "-X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -s -w -buildid=" -tags "${TAGS}" -o meta
|
run: |
|
||||||
|
go env
|
||||||
|
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="
|
||||||
- name: Upload file to workspace
|
- name: Upload file to workspace
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user