-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from MadBomber/gh_actions
Gh actions
- Loading branch information
Showing
2 changed files
with
119 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Adapted from https://github.com/casey/just/blob/master/bin/package | ||
# Intended for use in github actions | ||
# | ||
|
||
set -euxo pipefail | ||
|
||
REF=$1 | ||
OS=$2 | ||
TARGET=$3 | ||
VERSION=${REF#"refs/tags/"} | ||
DIST=`pwd`/dist | ||
EXECUTABLE=crystal/bin/justprep | ||
|
||
|
||
echo "Packaging justprep $VERSION for $TARGET..." | ||
|
||
echo "Building justprep ..." | ||
|
||
just crystal/build | ||
|
||
|
||
if [[ $OS == windows-latest ]]; then | ||
EXECUTABLE=$EXECUTABLE.exe | ||
fi | ||
|
||
echo "Copying release files..." | ||
mkdir dist | ||
cp \ | ||
$EXECUTABLE \ | ||
LICENSE \ | ||
CHANGELOG.md \ | ||
README.md \ | ||
$DIST | ||
|
||
cd $DIST | ||
echo "Creating release archive..." | ||
|
||
case "$OS" in | ||
"windows-latest") | ||
ARCHIVE=$DIST/justprep-$VERSION-$TARGET.zip | ||
7z a $ARCHIVE * | ||
echo "::set-output name=archive::`pwd -W`/just-$VERSION-$TARGET.zip" | ||
;; | ||
*) | ||
ARCHIVE=$DIST/justprep-$VERSION-$TARGET.tar.gz | ||
tar czf $ARCHIVE * | ||
echo "::set-output name=archive::$ARCHIVE" | ||
;; | ||
esac |