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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
#!/bin/sh
#
# Usage:
# ./scripts/publish-macosx.sh [buildonly]
#
VERSION=2021.01
VERSIONDATE=2021.01.31
export NUMCPU=$(sysctl -n hw.ncpu)
human_filesize()
{
awk -v sum=$1 'BEGIN {
hum[1024**3]="GB"; hum[1024**2]="MB"; hum[1024]="KB";
for (x=1024**3; x>=1024; x/=1024) {
if (sum>=x) { printf "%.1f %s\n",sum/x,hum[x]; break }
}
}'
}
# Pass version=<version> packagefile=<packagefile> filesize=<bytes>
update_www_download_links()
{
# Make the passed variables available
local $*
filesize=$(human_filesize $filesize)
webdir=../openscad.github.com
# FIXME: release vs. snapshot
incfile=inc/mac_snapshot_links.js
BASEURL='http://files.openscad.org/snapshots'
DATECODE=`date +"%Y.%m.%d"`
if [ -f $webdir/$incfile ]; then
cd $webdir
echo "fileinfo['MAC_SNAPSHOT_URL'] = '$BASEURL/$packagefile'" > $incfile
echo "fileinfo['MAC_SNAPSHOT_NAME'] = 'OpenSCAD $version'" >> $incfile
echo "fileinfo['MAC_SNAPSHOT_SIZE'] = '$filesize'" >> $incfile
echo 'modified mac_snapshot_links.js'
git --no-pager diff
echo "Web page updated. Remember to commit and push openscad.github.com"
else
echo "Web page not found at $incfile"
fi
}
# Cmd-line parameters
DOUPLOAD=1
if [ "`echo $* | grep buildonly`" ]; then
echo "Build only, no upload"
DOUPLOAD=
fi
if test -z "$VERSIONDATE"; then
VERSIONDATE=`date "+%Y.%m.%d"`
fi
if test -z "$VERSION"; then
VERSION=$VERSIONDATE
SNAPSHOT=snapshot
fi
SHORTVERSION=${VERSION%%-*}
# Turn off ccache, just for safety
PATH=${PATH//\/opt\/local\/libexec\/ccache:}
export MACOSX_DEPLOYMENT_TARGET=10.9
# This is the same location as DEPLOYDIR in macosx-build-dependencies.sh
export OPENSCAD_LIBRARIES=$PWD/../libraries/install
# Make sure that the correct Qt tools are used
export PATH=$OPENSCAD_LIBRARIES/bin:$PATH
`dirname $0`/release-common.sh -v $VERSION $SNAPSHOT
if [[ $? != 0 ]]; then
exit 1
fi
echo "Sanity check of the app bundle..."
`dirname $0`/macosx-sanity-check.py OpenSCAD.app/Contents/MacOS/OpenSCAD
if [[ $? != 0 ]]; then
exit 1
fi
SIGNATURE=$(openssl dgst -sha1 -binary < OpenSCAD-$VERSION.dmg | openssl dgst -dss1 -sign $HOME/.ssh/openscad-appcast.pem | openssl enc -base64)
if [[ $VERSION == $VERSIONDATE ]]; then
APPCASTFILE=appcast-snapshots.xml
else
APPCASTFILE=appcast.xml
fi
echo "Creating appcast $APPCASTFILE..."
FILESIZE=$(stat -f "%z" OpenSCAD-$VERSION.dmg)
sed -e "s,@VERSION@,$VERSION,g" -e "s,@SHORTVERSION@,$SHORTVERSION,g" -e "s,@VERSIONDATE@,$VERSIONDATE,g" -e "s,@DSASIGNATURE@,$SIGNATURE,g" -e "s,@FILESIZE@,$FILESIZE,g" $APPCASTFILE.in > $APPCASTFILE
cp $APPCASTFILE ../openscad.github.com
if [[ $VERSION == $VERSIONDATE ]]; then
cp $APPCASTFILE ../openscad.github.com/appcast-snapshots.xml
fi
if [ ! $DOUPLOAD ]; then
exit 0
fi
echo "Uploading..."
if [[ $VERSION == $VERSIONDATE ]]; then
scp OpenSCAD-$VERSION.dmg openscad@files.openscad.org:www/snapshots
else
scp OpenSCAD-$VERSION.dmg openscad@files.openscad.org:www
fi
if [[ $? != 0 ]]; then
exit 1
fi
scp $APPCASTFILE openscad@files.openscad.org:www/
if [[ $? != 0 ]]; then
exit 1
fi
if [[ $VERSION == $VERSIONDATE ]]; then
scp $APPCASTFILE openscad@files.openscad.org:www/appcast-snapshots.xml
if [[ $? != 0 ]]; then
exit 1
fi
fi
# Update snapshot filename on web page
update_www_download_links version=$VERSION packagefile=OpenSCAD-$VERSION.dmg filesize=$FILESIZE
|