Release v1.0.1
This commit is contained in:
+45
-26
@@ -13,35 +13,54 @@ echo "Current version: $current"
|
|||||||
|
|
||||||
IFS='.' read -r major minor patch <<< "$current"
|
IFS='.' read -r major minor patch <<< "$current"
|
||||||
|
|
||||||
if [ "${1:-}" = "--increment" ]; then
|
patch=$((patch + 1))
|
||||||
patch=$((patch + 1))
|
new_version="${major}.${minor}.${patch}"
|
||||||
new_version="${major}.${minor}.${patch}"
|
echo "New version: $new_version"
|
||||||
echo "Auto-incrementing to: $new_version"
|
|
||||||
else
|
|
||||||
echo "Increment version? [y/N]"
|
|
||||||
read -r answer
|
|
||||||
if [[ "$answer" =~ ^[Yy] ]]; then
|
|
||||||
echo " 1) patch (${major}.${minor}.$((patch + 1)))"
|
|
||||||
echo " 2) minor (${major}.$((minor + 1)).0)"
|
|
||||||
echo " 3) major ($((major + 1)).0.0)"
|
|
||||||
echo -n "Choice [1]: "
|
|
||||||
read -r choice
|
|
||||||
case "${choice:-1}" in
|
|
||||||
1) patch=$((patch + 1)); new_version="${major}.${minor}.${patch}" ;;
|
|
||||||
2) minor=$((minor + 1)); patch=0; new_version="${major}.${minor}.${patch}" ;;
|
|
||||||
3) major=$((major + 1)); minor=0; patch=0; new_version="${major}.${minor}.${patch}" ;;
|
|
||||||
*) echo "Invalid choice" >&2; exit 1 ;;
|
|
||||||
esac
|
|
||||||
echo "New version: $new_version"
|
|
||||||
else
|
|
||||||
new_version="$current"
|
|
||||||
echo "Keeping version: $new_version"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$new_version" > "$VERSION_FILE"
|
echo "$new_version" > "$VERSION_FILE"
|
||||||
|
|
||||||
echo "Building arrman v${new_version}..."
|
echo "Building arrman v${new_version}..."
|
||||||
go build -ldflags "-X main.Version=${new_version}" -o arrman .
|
go build -ldflags "-X main.Version=${new_version}" -o arrman .
|
||||||
|
|
||||||
echo "Done: ./arrman v${new_version}"
|
echo "Build successful: ./arrman v${new_version}"
|
||||||
|
|
||||||
|
# --- Git commit & push ---
|
||||||
|
echo ""
|
||||||
|
echo "Committing changes..."
|
||||||
|
git add -A
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit, skipping."
|
||||||
|
else
|
||||||
|
git commit -m "Release v${new_version}"
|
||||||
|
echo "Committed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Pushing to origin..."
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
# --- Git tag ---
|
||||||
|
tag="v${new_version}"
|
||||||
|
echo "Creating tag ${tag}..."
|
||||||
|
git tag -a "${tag}" -m "Release ${tag}"
|
||||||
|
git push origin "${tag}"
|
||||||
|
|
||||||
|
# --- Gitea release ---
|
||||||
|
echo ""
|
||||||
|
echo "Creating Gitea release..."
|
||||||
|
|
||||||
|
# Generate release notes from git log since last tag
|
||||||
|
prev_tag=$(git tag --sort=-v:refname | grep -v "^${tag}$" | head -1 || true)
|
||||||
|
if [ -n "$prev_tag" ]; then
|
||||||
|
release_notes=$(git log --pretty=format:"- %s" "${prev_tag}..${tag}")
|
||||||
|
else
|
||||||
|
release_notes=$(git log --pretty=format:"- %s" "${tag}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
tea release create \
|
||||||
|
--tag "${tag}" \
|
||||||
|
--title "${tag}" \
|
||||||
|
--note "$release_notes" \
|
||||||
|
--asset ./arrman
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Done! Published arrman ${tag}"
|
||||||
|
|||||||
Reference in New Issue
Block a user