From 8663c1734559da12f9cf829fb1c1c0ad896bbb31 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 26 Jan 2022 21:29:22 +0800 Subject: [PATCH] github action build config --- .github/workflows/dev.yml | 44 +++++++++++++++++++++++++++++++++++++++ Makefile | 14 ++++++++++--- 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/dev.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 00000000..1c0b0a62 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,44 @@ +name: Dev +on: [push] +jobs: + dev-build: + if: ${{ !contains(github.event.head_commit.message, '[Skip CI]') }} + runs-on: ubuntu-latest + steps: + - name: Get latest go version + id: version + run: | + echo ::set-output name=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') + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: ${{ steps.version.outputs.go_version }} + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Cache go module + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- +# - name: Get dependencies, run test +# run: | +# go test ./... + - name: Build + if: success() + env: + NAME: Clash.Meta + BINDIR: bin + run: make -j releases + + - name: Upload Dev + uses: softprops/action-gh-release@v1 + if: ${{ env.GIT_BRANCH != 'Meta' && success() }} + with: + tag_name: develop + files: bin/* + prerelease: true + diff --git a/Makefile b/Makefile index f547164e..7c2a5980 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ NAME=Clash.Meta BINDIR=bin -VERSION=$(shell git describe --tags || echo "unknown version") +BRANCH=$(shell git rev-parse --abbrev-ref HEAD) +VERSION=$(shell git describe --tags || echo "unknown version" ) +ifeq ($(BRANCH),Dev) +VERSION=develop-$(shell git rev-parse --short HEAD) +endif BUILDTIME=$(shell date -u) AUTOIPTABLES=Enable GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=$(VERSION)" \ @@ -38,7 +42,11 @@ WINDOWS_ARCH_LIST = \ windows-arm32v7 -all: linux-arm64-AutoIptables linux-amd64-AutoIptables linux-arm64 linux-amd64 darwin-amd64 darwin-arm64 windows-amd64 windows-386 # Most used +all:linux-amd64-AutoIptables linux-amd64\ + linux-arm64 linux-arm64-AutoIptables linux-armv7\ + darwin-amd64 darwin-arm64\ + windows-amd64 windows-386 \ + linux-mips-hardfloat linux-mips-softfloat linux-mips64 linux-mips64le linux-mipsle-hardfloat linux-mipsle-softfloat# Most used docker: $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ @@ -141,4 +149,4 @@ all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) releases: $(gz_releases) $(zip_releases) clean: - rm $(BINDIR)/* \ No newline at end of file + rm $(BINDIR)/*