feat(ci): Added release step for tag

Skip compress process for PR build
Add commit message check
Add release-note
This commit is contained in:
Yuxing Deng
2024-07-18 10:29:27 +08:00
parent 979b4991fa
commit 896e03e279
5 changed files with 81 additions and 21 deletions

View File

@@ -4,6 +4,8 @@ set -e
source "$(dirname $0)/version"
cd "$(dirname $0)/.."
rm -rf ./bin/* ./dist/*
OS_ARCH_ARG_LINUX="amd64 arm arm64"
OS_ARCH_ARG_DARWIN="amd64 arm64"
OS_ARCH_ARG_WINDOWS="amd64"
@@ -61,19 +63,19 @@ case "$CROSS" in
;;
esac
mkdir -p "$DAPPER_SOURCE/bin"
mkdir -p "$DAPPER_SOURCE/dist"
mkdir -p "./bin"
mkdir -p "./dist"
for f in ./bin/*; do
filename=$(basename "$f")
if [[ $filename != *darwin* ]]; then
upx -o "$DAPPER_SOURCE/dist/$filename" "bin/$filename" || true
fi
if [ -f "$DAPPER_SOURCE/dist/$filename" ]; then
echo "UPX done!"
if [[ $filename != *darwin* && -z "$SKIP_COMPRESS" ]]; then
if upx -o "./dist/$filename" "$f"; then
echo "UPX done for $filename!"
else
echo "UPX failed for $filename, copying original file."
cp "$f" "./dist/$filename"
fi
else
echo "Copy origin file as UPX failed!!!"
cp "bin/$filename" "$DAPPER_SOURCE/dist/$filename"
cp "$f" "./dist/$filename"
fi
done

42
scripts/release-note Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env sh
set -e
source "$(dirname $0)/version"
cd "$(dirname $0)/.."
mkdir -p dist
TARGET_PATH="dist/release-note"
if [ -z "$(command -v release-notary)" ]; then
echo "release-notary is not found, skip generating release notes."
exit 0
fi
if [ -z "${GIT_TAG}" ]; then
echo "running this scrpit without tag, skip generating release notes."
exit 0
fi
GIT_TAG=$(echo "${GIT_TAG}" | grep -E "^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$") || true
if [ "${GIT_TAG}" = "" ]; then
echo "git GIT_TAG is not validated, skip generating release notes."
exit 0
fi
for tag in $(git tag -l --sort=-v:refname); do
if [ "${tag}" = "${GIT_TAG}" ]; then
continue
fi
filterred=$(echo "${tag}" | grep -E "^v([0-9]+)\.([0-9]+)(\.[0-9]+)?(-rc[0-9]*)$") || true
if [ "${filterred}" = "" ]; then
echo "get real release tag ${tag}, stopping untag"
break
fi
git tag -d ${tag}
done
echo "following release notes will be published..."
release-notary publish -d 2>/dev/null | sed '1d' | sed '$d' > $TARGET_PATH
cat "$TARGET_PATH"