Skip to content

Commit

Permalink
Add bash script to create release
Browse files Browse the repository at this point in the history
  • Loading branch information
cobaltgit committed Oct 10, 2024
1 parent 65db393 commit 965985d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion create_spruce_release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set "output7z=%archiveName%V%version%.7z"

REM Create the 7z file excluding this script and all git-related files
echo Creating 7z archive "%output7z%"...
7z a -t7z -mx=9 -xr!.git* -x!.gitignore -x!.gitattributes -x!"%~nx0" "%output7z%" *
7z a -t7z -mx=9 -xr!.git* -x!.gitignore -x!.gitattributes -x!"%~nx0" -x!create_spruce_release.sh "%output7z%" *

REM Check if 7z creation was successful
if %errorlevel% neq 0 (
Expand Down
40 changes: 40 additions & 0 deletions create_spruce_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

cd "$(dirname "$0")"

ARCHIVE_NAME="spruce"
VERSION_FILE="spruce/spruce"
VERSION=

if [ ! -f "$VERSION_FILE" ]; then
echo "Error: could not find file $VERSION_FILE"
read
exit 1
fi

VERSION=$(< "$VERSION_FILE")

if [ "$VERSION" == "" ]; then
echo "Error: failed to retrieve version from $VERSION_FILE"
read
exit 1
fi

OUTPUT_7Z="${ARCHIVE_NAME}V${VERSION}.7z"

if [ -f "$OUTPUT_7Z" ]; then
echo "Removing already existing $OUTPUT_7Z"
rm "$OUTPUT_7Z"
fi

7z a -t7z -mx=9 -xr!.git* -x!.gitignore -x!.gitattributes -x!"$(basename "$0")" -x!create_spruce_release.bat "$OUTPUT_7Z" *

if [ $? -ne 0 ]; then
echo "Error: failed to create 7z archive"
read
exit 1
fi

echo "7z archive $OUTPUT_7Z created successfully"
read
exit 0

0 comments on commit 965985d

Please sign in to comment.