From 1f88cb32af6ac711b039bf47a03f864c500f640e Mon Sep 17 00:00:00 2001 From: Hiddify <114227601+hiddify-com@users.noreply.github.com> Date: Wed, 3 Jan 2024 16:23:11 +0000 Subject: [PATCH] new: add podspec in make file --- .github/workflows/release.yml | 1 - .github/Libcore.podspec => Libcore.podspec | 0 Makefile | 30 ++++++++++++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) rename .github/Libcore.podspec => Libcore.podspec (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08d698d..41c4a7b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,6 @@ jobs: rm ./bin/hiddify-libcore-macos-a*.dylib || echo "no macos arm and amd" if [[ "${{ matrix.job.target }}" == "ios" ]];then cd bin - cp .github/Libcore.podspec ./hiddify-libcore-ios.xcframework/ tar -czvf hiddify-libcore-ios.xcframework.tar.gz hiddify-libcore-ios.xcframework rm -rf hiddify-libcore-ios.xcframework else diff --git a/.github/Libcore.podspec b/Libcore.podspec similarity index 100% rename from .github/Libcore.podspec rename to Libcore.podspec diff --git a/Makefile b/Makefile index 422d232..d721fc2 100644 --- a/Makefile +++ b/Makefile @@ -21,10 +21,14 @@ android: lib_install gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -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)/$(PRODUCT_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)/$(PRODUCT_NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile &&\ + mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(NAME).xcframework &&\ + cp Libcore.podspec $(BINDIR)/$(NAME).xcframework/ + 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)/$(PRODUCT_NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile &&\ - mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(NAME).xcframework + mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(NAME).xcframework &&\ + cp Libcore.podspec $(BINDIR)/$(NAME).xcframework/ windows-amd64: @@ -42,3 +46,25 @@ macos-universal: macos-amd64 macos-arm64 clean: rm $(BINDIR)/* + + +release: # Create a new tag for release. + @echo "previous version was $$(git describe --tags $$(git rev-list --tags --max-count=1))" + @echo "WARNING: This operation will creates version tag and push to github" + @bash -c '\ + read -p "Version? (provide the next x.y.z semver) : " TAG && \ + echo $$TAG &&\ + [[ "$$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } && \ + IFS="." read -r -a VERSION_ARRAY <<< "$$TAG" && \ + VERSION_STR="$${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}" && \ + BUILD_NUMBER=$$(( $${VERSION_ARRAY[0]} * 10000 + $${VERSION_ARRAY[1]} * 100 + $${VERSION_ARRAY[2]} )) && \ + echo "version: $${VERSION_STR}+$${BUILD_NUMBER}" && \ + sed -i "s/^s.version: .*/s.version = '$${VERSION_STR}'/g" Libcore.podspec && \ + git tag $${TAG} > /dev/null && \ + git tag -d $${TAG} > /dev/null && \ + git add Libcore.podspec && \ + git commit -m "release: version $${TAG}" && \ + echo "creating git tag : v$${TAG}" && \ + git tag v$${TAG} && \ + git push -u origin HEAD --tags && \ + echo "Github Actions will detect the new tag and release the new version."'