new: automated version release

This commit is contained in:
Hiddify
2023-09-15 10:44:41 +02:00
parent e25a0532f7
commit d0e762596e
4 changed files with 44 additions and 1 deletions

View File

@@ -96,3 +96,29 @@ build-macos-libs:
build-ios-libs: #not tested
make -C libcore -f Makefile ios && mv $(BINDIR)/$(CORE_NAME)-ios.xcframework $(DESKTOP_OUT)/libcore.xcframework
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" && \
BUILD_NUMBER=$$(( $${VERSION_ARRAY[0]} * 10000 + $${VERSION_ARRAY[1]} * 100 + $${VERSION_ARRAY[2]} )) && \
echo "version: $${TAG}+$${BUILD_NUMBER}" && \
sed -i "s/version: .*/version: $${TAG}+$${BUILD_NUMBER}/g" pubspec.yaml && \
git tag $${TAG} && \
gitchangelog > changelog.md || { git tag -d $${TAG}; echo "Please run pip install gitchangelog"; exit 2; } && \
git tag -d $${TAG} && \
git add pubspec.yaml changelog.md && \
# ./update_translations.sh && \
# git add assets/translations/* && \
#git commit -m "release: version $${TAG} 🚀" && \
echo "creating git tag : $${TAG}" && \
#@git tag $${TAG} && \
#@git push -u origin HEAD --tags && \
echo "Github Actions will detect the new tag and release the new version."'