Update build

This commit is contained in:
problematicconsumer
2023-09-11 15:20:19 +03:30
parent fab61a0de8
commit ff570f9075
2 changed files with 37 additions and 20 deletions

View File

@@ -1,8 +1,8 @@
name: Release
on:
push:
branches:
- main
tags:
- "v*"
paths-ignore:
- '**.md'
- 'docs/**'
@@ -77,12 +77,25 @@ jobs:
name: artifact
path: bin/
- name: Create or Update Draft Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-release:
permissions: write-all
if: ${{ github.ref_type=='tag' }}
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
files: ./bin/*
name: "draft"
tag_name: "draft"
prerelease: true
name: artifact
path: bin/
- name: Display Files Structure
run: ls -R
working-directory: bin
- name: Upload Release
uses: softprops/action-gh-release@v1
if: ${{ success() }}
with:
tag_name: ${{ github.ref_name }}
files: bin/*

View File

@@ -1,6 +1,10 @@
NAME=hiddify-libcore
BASENAME=hiddify-libcore
BINDIR=bin
BRANCH=$(shell git branch --show-current)
VERSION=$(shell git describe --tags || echo "unknown version")
NAME=$(BASENAME)-$@-$(VERSION)
TAGS=with_gvisor,with_quic,with_wireguard,with_utls,with_clash_api
GOBUILD=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
@@ -9,28 +13,28 @@ lib_install:
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.0.0-20230728014906-3de089147f59
headers:
go build -buildmode=c-archive -o $(BINDIR)/$(NAME)-$@.h ./custom
go build -buildmode=c-archive -o $(BINDIR)/$(NAME).h ./custom
android: lib_install
gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -ldflags="-w -s" -target=android -o $(BINDIR)/$(NAME)-$@.aar github.com/sagernet/sing-box/experimental/libbox ./mobile
gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -ldflags="-w -s" -target=android -o $(BINDIR)/$(NAME).aar github.com/sagernet/sing-box/experimental/libbox ./mobile
ios-full: lib_install
gomobile bind -v -target ios,iossimulator,tvos,tvossimulator,macos -libname=box -tags=$(TAGS),with_dhcp,with_low_memory,with_conntrack -trimpath -ldflags="-w -s" -o $(BINDIR)/$(NAME)-$@.xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
gomobile bind -v -target ios,iossimulator,tvos,tvossimulator,macos -libname=box -tags=$(TAGS),with_dhcp,with_low_memory,with_conntrack -trimpath -ldflags="-w -s" -o $(BINDIR)/$(NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
ios: lib_install
gomobile bind -v -target ios -libname=box -tags=$(TAGS),with_dhcp,with_low_memory,with_conntrack -trimpath -ldflags="-w -s" -o $(BINDIR)/$(NAME)-$@.xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
gomobile bind -v -target ios -libname=box -tags=$(TAGS),with_dhcp,with_low_memory,with_conntrack -trimpath -ldflags="-w -s" -o $(BINDIR)/$(NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile
windows-amd64:
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.dll ./custom
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME).dll ./custom
linux-amd64:
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.so ./custom
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINDIR)/$(NAME).so ./custom
macos-amd64:
env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),with_dhcp,with_low_memory,with_conntrack -buildmode=c-shared -o $(BINDIR)/$(NAME)-$@.dylib ./custom
env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),with_dhcp,with_low_memory,with_conntrack -buildmode=c-shared -o $(BINDIR)/$(NAME).dylib ./custom
macos-arm64:
env GOOS=darwin GOARCH=arm64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),with_dhcp,with_low_memory,with_conntrack -buildmode=c-shared -o $(BINDIR)/$(NAME)-$@.dylib ./custom
env GOOS=darwin GOARCH=arm64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags $(TAGS),with_dhcp,with_low_memory,with_conntrack -buildmode=c-shared -o $(BINDIR)/$(NAME).dylib ./custom
macos-universal: macos-amd64 macos-arm64
lipo -create $(BINDIR)/$(NAME)-macos-amd64.dylib $(BINDIR)/$(NAME)-macos-arm64.dylib -output $(BINDIR)/$(NAME)-$@.dylib
lipo -create $(BINDIR)/$(BASENAME)-macos-amd64-$(VERSION).dylib $(BINDIR)/$(BASENAME)-macos-arm64-$(VERSION).dylib -output $(BINDIR)/$(NAME).dylib
clean:
rm $(BINDIR)/*