-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.sh
executable file
·61 lines (45 loc) · 1.2 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
PREFIX=gc_to_n64
HEXFILE=$PREFIX.hex
VERSION=`grep VERSION= Makefile | cut -d '=' -f 2`
echo "Release script for $PREFIX"
if [ $# -ne 1 ]; then
echo "Syntax: ./release.sh releasedir"
echo
echo "ex: './release releasedir' will produce $PREFIX-$VERSION.tar.gz in releasedir out of git HEAD."
exit
fi
FULLNAME=$PREFIX-$VERSION.tar.gz
if [ -e $RELEASEDIR/$FULLNAME ]; then
echo $FULLNAME already exists in $RELEASEDIR
exit
fi
RELEASEDIR=`readlink -f $1`
DIRNAME=$PREFIX-$VERSION
FILENAME=$PREFIX-$VERSION.tar.gz
TAG=v$VERSION
echo "Version: $VERSION"
echo "Filename: $FILENAME"
echo "Release directory: $RELEASEDIR"
echo "--------"
echo "Ready? Press ENTER to go ahead (or CTRL+C to cancel)"
read
if [ -f $RELEASEDIR/$FILENAME ]; then
echo "Release file already exists!"
exit 1
fi
git tag $TAG -f -a -m "Release $VERSION"
git archive --format=tar --prefix=$DIRNAME/ HEAD | gzip > $RELEASEDIR/$FILENAME
cd $RELEASEDIR
echo "Untarring..."
tar zxf $FILENAME
echo "Building..."
cd $PREFIX-$VERSION
make clean
make
if [ ! -e gc_to_n64b.hex ]; then
echo "Build error, missing artefact";
exit
fi
cp -v gc_to_n64b.hex ../$PREFIX-$VERSION.hex
ls -lh ../$PREFIX-$VERSION.hex ../$PREFIX-$VERSION.tar.gz