Script artifact generation

This commit is contained in:
Simon Gellis 2024-12-16 00:38:16 -05:00
parent 1b8207db17
commit ba7a2c47b0
3 changed files with 48 additions and 1 deletions

View File

@ -13,3 +13,13 @@ cargo build --release
``` ```
The executable will be in `target/release/lemur[.exe]` The executable will be in `target/release/lemur[.exe]`
## Release
Bump the version number in `Cargo.toml`, then run this script:
```sh
./scripts/release.sh
```
It uses docker to cross compile for Windows, MacOS, and Linux. All binaries are left in the `output` directory.

31
scripts/do-release.sh Executable file
View File

@ -0,0 +1,31 @@
# Set everything up
rm -rf output
mkdir -p output
cargo clean
# Build for linux
cargo build --release
cp target/release/lemur output/lemur-linux
# Bundle for Linux
cargo bundle --release --format deb
cp target/release/bundle/deb/*.deb output
# Build for Windows
cargo build --release --target x86_64-pc-windows-msvc
cp target/x86_64-pc-windows-msvc/release/lemur.exe output
# Bundle for Windows
cargo bundle --release --target x86_64-pc-windows-msvc --format msi
cp target/x86_64-pc-windows-msvc/release/bundle/msi/Lemur.msi output
# Build for MacOS
cargo build --release --target x86_64-apple-darwin
cp target/x86_64-apple-darwin/release/lemur output/lemur-osx
# Bundle for MacOS
cargo bundle --release --target x86_64-apple-darwin --format osx
genisoimage -V lemur -D -R -apple -no-pad -o output/Lemur.dmg target/x86_64-apple-darwin/release/bundle/osx
# Clean up after ourselves
cargo clean

6
scripts/release.sh Executable file
View File

@ -0,0 +1,6 @@
if [ -z "${RELEASE_TOKEN}" ]; then
echo "Please set the RELEASE_TOKEN env var."
exit 1
fi
docker build -f build.Dockerfile -t lemur-build .
docker run -it --rm -e RELEASE_TOKEN="${RELEASE_TOKEN}" -v .:/app -w /app --entrypoint bash lemur-build /app/scripts/do-release.sh