Skip to content

Commit

Permalink
Release script
Browse files Browse the repository at this point in the history
  • Loading branch information
onimitch committed Dec 6, 2023
1 parent d964802 commit 10a8c0e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
release.sh export-ignore
.gitattributes export-ignore
.gitmodules export-ignore
.gitignore export-ignore
31 changes: 31 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Please specify an archive name."
echo "Usage: ./release.sh <archive name> <version>"
exit 1
fi
if [ -z "$2" ]; then
echo "Please specify a version number."
echo "Usage: ./release.sh <archive name> <version>"
exit 1
fi

prefix="$1"
outfile="$PWD/$1_$2.zip"
temp_dir="$PWD/release_temp"
temp_zip="$PWD/temp.zip"

rm -rf "$temp_zip"
rm -rf "$temp_dir"
mkdir -p "$temp_dir"

git archive --format=zip --prefix "$prefix/" HEAD > "$temp_zip" && unzip "$temp_zip" -d "$temp_dir" && rm -rf "$temp_zip"
git submodule foreach --recursive " git archive --format=zip --prefix=\"$prefix/\$sm_path/\" HEAD > \"$temp_zip\" && unzip \"$temp_zip\" -d \"$temp_dir\" && rm -rf \"$temp_zip\" "

rm -rf "$outfile"
7z a "$outfile" "$temp_dir/$prefix"

# cleanup
rm -rf "$temp_zip"
rm -rf "$temp_dir"

0 comments on commit 10a8c0e

Please sign in to comment.