Skip to content

Commit

Permalink
Automate creating and uploading release
Browse files Browse the repository at this point in the history
  • Loading branch information
ki3v committed Sep 7, 2023
1 parent abcceb4 commit 16b8658
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ cfg/
*.sym
config.inc
*.bin
!a2vmemnoram.bin
!a2vmemnoram.bin
*.zip
*.html
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CHECKSUM = sha1sum --tag
config.inc: config_inc.sh *.asm inc/*
sh $< > $@

.INTERMEDIATE: config.inc
.SECONDARY: config.inc


export QUICKTEST
Expand All @@ -38,10 +38,10 @@ run: $(OUTPUT)
$(MAME) apple2p -ramsize $(RAMSIZE) -keepaspect -volume -10 -window -resolution 800x600 -skip_gameinfo -debug -debugger $(DEBUGGER)

clean:
rm -f *.lst *.o *.map *.sym config_inc.sh
rm -f *.lst *.o *.map *.sym

cleanall: clean
rm -f *.bin
rm -f apple2.bin config.inc appleII_deadtest*.zip

showver:
@git describe --tags --long --always --dirty=-L --broken=-X
Expand Down
2 changes: 1 addition & 1 deletion config_inc.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

if (git --version > /dev/null 2>&1); then
VERSION=`git describe --tags --always --dirty=-L --broken=-X | tr a-z A-Z`
VERSION=`git describe --tags --always --dirty=-LOCAL --broken=-X | tr a-z A-Z`
else
VERSION="LOCAL_BUILD"
fi
Expand Down
69 changes: 69 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FILES="apple2.bin LICENSE.html README.html"
DELETE="README.html LICENSE.html"

abort() {
echo "Aborting: $*"
rm -f $DELETE
exit -1
}

checktool() {
if ! $* > /dev/null 2>&1 ; then
abort "\"$1\" is required but was not found."
fi
}

md2html() {
B=`basename $1 .md`
H=$B.html
if ! pandoc $1 -f markdown -t html -s -o $H -V mainfont=sans-serif -V maxwidth=50em --metadata title="$B"
then
abort "Couldn't create README.html"
fi
}

checktool git --version
checktool gh --version
checktool zip --version
checktool pandoc --version

if [ "x$1" == "x" ]; then
echo "Usage: $0 <version>"
exit -1
fi

TAG=$1

STATUS=`git status --porcelain`
if [ "x$STATUS" != "x" ]; then
git status --short
abort "Working directory contains modified files."
fi

if ! git tag -a $1 -m $1 ; then
abort "Failed to create git tag \"$1\""
fi
if ! git push origin $1 ; then
abort "Failed to push \"$1\" to the origin"
fi

ZIPFILE=appleII_deadtest-BIN-$TAG.zip

if ! make cleanall all ; then
abort "Couldn't create \"$ZIPFILE\""
fi

md2html README.md
md2html LICENSE.md

if ! zip $ZIPFILE $FILES ; then
abort "Couldn't create \"$ZIPFILE\""
fi

if ! gh release create $TAG --draft --generate-notes ; then
abort "Couldn't create the release"
fi

if ! gh release upload $TAG $FILES $ZIPFILE ; then
abort "Couldn't upload the release files"
fi

0 comments on commit 16b8658

Please sign in to comment.