github action build config
This commit is contained in:
parent
9c0705f310
commit
8663c17345
2 changed files with 55 additions and 3 deletions
44
.github/workflows/dev.yml
vendored
Normal file
44
.github/workflows/dev.yml
vendored
Normal file
|
@ -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
|
||||
|
14
Makefile
14
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)/*
|
||||
rm $(BINDIR)/*
|
||||
|
|
Loading…
Reference in a new issue