Release build script reads from anvil version
This commit is contained in:
15
README.md
15
README.md
@@ -409,19 +409,22 @@ The binary lands at `target\release\anvil.exe`.
|
||||
### Release builds (Linux + Windows from one machine)
|
||||
|
||||
The `build-release.sh` script at the repo root builds optimized, stripped
|
||||
binaries for both platforms and packages them into tarballs and zips:
|
||||
binaries for both platforms and packages them into tarballs and zips. It
|
||||
reads the version from `Cargo.toml` (the single source of truth) and
|
||||
accepts an optional suffix for pre-release builds:
|
||||
|
||||
```bash
|
||||
./build-release.sh # uses git describe for version
|
||||
./build-release.sh v1.2.0 # explicit version tag
|
||||
./build-release.sh # uses version from Cargo.toml (e.g. 1.0.0)
|
||||
./build-release.sh beta1 # appends suffix (e.g. 1.0.0-beta1)
|
||||
./build-release.sh rc1 # appends suffix (e.g. 1.0.0-rc1)
|
||||
```
|
||||
|
||||
This produces a `release-artifacts/` directory with:
|
||||
|
||||
```
|
||||
anvil-v1.2.0-linux-x86_64.tar.gz
|
||||
anvil-v1.2.0-linux-x86_64.zip
|
||||
anvil-v1.2.0-windows-x86_64.zip
|
||||
anvil-1.0.0-linux-x86_64.tar.gz
|
||||
anvil-1.0.0-linux-x86_64.zip
|
||||
anvil-1.0.0-windows-x86_64.zip
|
||||
SHA256SUMS
|
||||
```
|
||||
|
||||
|
||||
@@ -2,14 +2,36 @@
|
||||
# Build release binaries for distribution
|
||||
# This script builds both Linux and Windows binaries (cross-compile)
|
||||
#
|
||||
# Usage:
|
||||
# ./build-release.sh # version from Cargo.toml (e.g. 1.0.0)
|
||||
# ./build-release.sh beta1 # appends suffix (e.g. 1.0.0-beta1)
|
||||
# ./build-release.sh rc1 # appends suffix (e.g. 1.0.0-rc1)
|
||||
#
|
||||
# For Windows-only builds, use build-release.ps1 on Windows
|
||||
# For Linux-only builds, comment out the Windows section below
|
||||
set -e
|
||||
|
||||
VERSION=${1:-$(git describe --tags --always)}
|
||||
# Read version from the single source of truth: Cargo.toml
|
||||
BASE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
||||
if [ -z "$BASE_VERSION" ]; then
|
||||
echo "Error: Could not read version from Cargo.toml"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optional suffix (beta1, rc1, etc.)
|
||||
if [ -n "$1" ]; then
|
||||
VERSION="${BASE_VERSION}-${1}"
|
||||
else
|
||||
VERSION="$BASE_VERSION"
|
||||
fi
|
||||
|
||||
RELEASE_DIR="release-artifacts"
|
||||
|
||||
echo "Building Anvil $VERSION release binaries..."
|
||||
echo "Building Anvil v${VERSION} release binaries..."
|
||||
echo " Version base: ${BASE_VERSION} (from Cargo.toml)"
|
||||
if [ -n "$1" ]; then
|
||||
echo " Suffix: ${1}"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Clean previous artifacts
|
||||
@@ -63,7 +85,7 @@ cd ..
|
||||
# Display results
|
||||
echo ""
|
||||
echo "==========================================================="
|
||||
echo " Release artifacts built successfully!"
|
||||
echo " Anvil v${VERSION} release artifacts built successfully!"
|
||||
echo "==========================================================="
|
||||
echo ""
|
||||
echo "Artifacts in $RELEASE_DIR/:"
|
||||
@@ -73,7 +95,7 @@ echo "Checksums:"
|
||||
cat "$RELEASE_DIR/SHA256SUMS"
|
||||
echo ""
|
||||
echo "Upload these files to your Gitea release:"
|
||||
echo " 1. Go to: Releases -> $VERSION -> Edit Release"
|
||||
echo " 1. Create release: Releases -> New Release -> Tag: v${VERSION}"
|
||||
echo " 2. Drag and drop files from $RELEASE_DIR/"
|
||||
echo " 3. Save"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user