From ba7a2c47b0fb60d1685ab27f11cf8ea4b46645d4 Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Mon, 16 Dec 2024 00:38:16 -0500 Subject: [PATCH] Script artifact generation --- README.md | 12 +++++++++++- scripts/do-release.sh | 31 +++++++++++++++++++++++++++++++ scripts/release.sh | 6 ++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 scripts/do-release.sh create mode 100755 scripts/release.sh diff --git a/README.md b/README.md index a756b8d..f134e02 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,14 @@ Run cargo build --release ``` -The executable will be in `target/release/lemur[.exe]` \ No newline at end of file +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. \ No newline at end of file diff --git a/scripts/do-release.sh b/scripts/do-release.sh new file mode 100755 index 0000000..c57b219 --- /dev/null +++ b/scripts/do-release.sh @@ -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 \ No newline at end of file diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..318742c --- /dev/null +++ b/scripts/release.sh @@ -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 \ No newline at end of file