Skip to content

Commit

Permalink
Automate release creation
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofl committed Dec 23, 2024
1 parent b74bca6 commit 6c32ee9
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions cross-build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ mkdir -p target/assets 2>/dev/null || true

# Cross-compile for each target platform
for target in "${TARGETS[@]}"; do
echo; echo "########################################################################################"; echo
echo "Cross-compiling gui version for $target..."

echo; echo "########################################################################################";
echo "Cross-compiling gui version for $target..."; echo
cross build --release --target "$target"
done

Expand All @@ -36,4 +35,34 @@ for target in "${TARGETS[@]}"; do
cp -vf target/${target}/release/quick-serve${ext} target/assets/quick-serve-${target}${ext} || true
done


if [[ "$*" == *--release* ]]; then
# Tag the new version
version=$(grep '^version =' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
notes=$(git log --pretty=format:'- %s' $(git describe --tags --abbrev=0 @^)..@)
# notes=$(git log $(git describe --tags --abbrev=0)..HEAD --oneline)

echo "Creating release v$version with notes:"
echo "$notes"

echo "Tagging the new version..."
git tag "v$version" -f
git push origin --tags -f

echo "Creating a release on GitHub..."
gh release delete "v$version" || true
# Create a release on GitHub and upload the files
gh release create "v$version" target/assets/* --title "v$version" --notes "$notes" --generate-notes

# Publish the new version to crates.io
echo; echo "Publishing the new version to crates.io..."
read -p "Do you want publish? (y/N): " answer
if [[ "$answer" == "y" ]]; then
cargo publish --allow-dirty --no-verify
else
cargo publish --allow-dirty --no-verify --dry-run
fi
fi


exit 0

0 comments on commit 6c32ee9

Please sign in to comment.