Skip to content

Commit

Permalink
First crack at automatic releases
Browse files Browse the repository at this point in the history
  • Loading branch information
griff committed Sep 10, 2017
1 parent 5cf7619 commit dc215f6
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 23 deletions.
39 changes: 32 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
os: osx
osx_image: xcode8.3

language: objective-c
before_install:
- openssl aes-256-cbc -K $encrypted_8e7577110561_key -iv $encrypted_8e7577110561_iv
-in sparkle_private.pem.enc -out sparkle_private.pem -d
install:
- echo "Hello"
- gem install xcpretty-travis-formatter

- echo "Hello"
- gem install xcpretty-travis-formatter
script:
- echo Script
- xcodebuild -version
- xcodebuild
- echo Script
- xcodebuild -version
- xcodebuild
before_deploy:
- source Scripts/tag-beta.bash
- mkdir Upload
- cp build/Release/MetaZ-* Upload/
- mv Upload/MetaZ-*.json Upload/Sparke.json
- mv Upload/MetaZ-*.xml Upload/Sparke.xml
- rm Upload/*.dmg
deploy:
- provider: releases
api_key:
secure: PaSyHBl2Yw2WfKQulZ/oJhGjBUZuAscrgJ56WoSP7B/WHEBUDi4uulX/sO8qobs5HEVcR3aIcSVGkbapf/QNKdSpVqzGyJbjl9GTvEtjMdulynS/xMd+Mc+DD4HdVm6N4aAJj6xpwylrZQF4fAhzZKEhtxZICqPdXfyIwJGRVrehuEWt47yyamOZ1dT4C+xed5xlDXfBuTWeyAn2idix70oAVX9mJHjQja9L8HR6Bg/9HMnkppxtm+p+vF+jkx+RHG+W1Y9LmLxoIgzJa4TKOPxlEXFG5kqsLPct5ZBaOj3TVm6jU6nwUpN4RetpF8an/rsIkpgPEP8r4lU7FY00GRcHn5lD2vBvw/8SOiW7tGuouqpvGFZqxEk2WxijuCKl//LKaxQOUaTG6B2Bj4eQ27rtzkMjYGK5OliH/2p52P45mrc++B/slnVNHxtlOG7R3N7tBOvRRkznyl+e0LQmTclWXaVViSDZ+FlkoFgVnqGk+VtOuMwN8kAQzgqtCJ0f/zOrpF4zzw27aRwMX1M+nhflwozBVNMVxez6Pfm35XKrs0Dv0Pae/WZFiZgbfGr5AlsPoJQa2TfpB4tbN3N7Ol7iqZT2k23vs4knv4l+3IRubvNkj8G5XJuf+7VjMQ7cU7k27B56nX9JBnRLY5/o5WdurcERe9B6zV6z/RHN4Vk=
file_glob: true
file: "Upload/*"
skip_cleanup: true
prerelease: true
on:
branch: develop
branches:
except:
- "/^v+[0-9]\\.+[0-9]\\.beta-+[0-9]/"
env:
global:
secure: iafuNhke+X5fGBoWVZl39Qr5jtzOlgNvtQ/9EQ309Jfjp0pHDsMqyBqJ43g7t1IEB28AiaKcuOqO3CTMDJDuvluo8vcyXRdpRZH/lupbD08/S3iLXBUuradko8Qg02C981Tw0ao0M12bk5JNVZhkTypK/yse4qRcGgB9N1o6CsERnEY2Vp3oGnqG6rhdHC7BUrIBZrdRZfG9EZt7WJoGMUMlCyfkP87Qgx+2KrY+GD/nCgP71U9kLDU8eWvCLj/+sy+tH94NWzF10ybKeQQaA1BUb6Ulrn/pdoDJ+JPojZsrCyODVTWKdjsduFXrq53WG+leuJoJ8MxvYKu3o5FPhpV1wVbHa7+4j6qWPl4IB3k0rG8abk01LJXe01CQvUiecsKd6CTgYRoTCS4z0VFsueOEsjmXJ4VWYm23LjjG3rGnmxuPI3UCMW5PQ5K/XsMWNd/k/KBIoWXBUOF5bFMi/ewVRgXLaNDdzEoQu9iRbzIsHyYTNHQ+RBPcmsntR/YqB5jYxlAQrPsP2hWNY3Oc2L89DOsDCmSOMsNTXmoSATJQSnLaoKERaZlxlwzAcxas725UBzjmPeLjuqZEL88dUuGdGu9cEbsQB9LoL2TtFlIDXuRiuO4r/yU3LT25waut+gpbDGXL5Qkzjyg8RMP0PwINFHXnVSzF+hpDsRuUnP8=
16 changes: 16 additions & 0 deletions MetaZ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,10 @@
1B4F53C9116E9F44003221B1 /* TheTVDBPlugin.mzsearchprovider */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TheTVDBPlugin.mzsearchprovider; sourceTree = BUILT_PRODUCTS_DIR; };
1B4F53DD116EA1B5003221B1 /* TheTVDBPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TheTVDBPlugin.h; sourceTree = "<group>"; };
1B4F53DE116EA1B5003221B1 /* TheTVDBPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TheTVDBPlugin.m; sourceTree = "<group>"; };
1B521CEA1F65558600979D60 /* document_types.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = document_types.bash; path = Scripts/document_types.bash; sourceTree = "<group>"; };
1B521CEB1F65558600979D60 /* make_diskimage.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = make_diskimage.bash; path = Scripts/make_diskimage.bash; sourceTree = "<group>"; };
1B521CEC1F65558600979D60 /* plist.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = plist.bash; path = Scripts/plist.bash; sourceTree = "<group>"; };
1B521CED1F65558600979D60 /* sparkle_sign.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = sparkle_sign.bash; path = Scripts/sparkle_sign.bash; sourceTree = "<group>"; };
1B523B4913F4B2B500C20B7D /* ASIAuthenticationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASIAuthenticationDialog.h; path = "Externals/asi-http-request/Classes/ASIAuthenticationDialog.h"; sourceTree = "<group>"; };
1B523B4A13F4B2B500C20B7D /* ASIAuthenticationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASIAuthenticationDialog.m; path = "Externals/asi-http-request/Classes/ASIAuthenticationDialog.m"; sourceTree = "<group>"; };
1B523B4B13F4B2B500C20B7D /* ASICacheDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASICacheDelegate.h; path = "Externals/asi-http-request/Classes/ASICacheDelegate.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1271,6 +1275,17 @@
path = TheTVDB/src;
sourceTree = "<group>";
};
1B521CE91F65557100979D60 /* Scripts */ = {
isa = PBXGroup;
children = (
1B521CEA1F65558600979D60 /* document_types.bash */,
1B521CEB1F65558600979D60 /* make_diskimage.bash */,
1B521CEC1F65558600979D60 /* plist.bash */,
1B521CED1F65558600979D60 /* sparkle_sign.bash */,
);
name = Scripts;
sourceTree = "<group>";
};
1B523B4813F4B24E00C20B7D /* asi-http-request */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1656,6 +1671,7 @@
29B97314FDCFA39411CA2CEA /* MetaZ */ = {
isa = PBXGroup;
children = (
1B521CE91F65557100979D60 /* Scripts */,
1B4494BC10D584E000B9C751 /* next_release.txt */,
1BEA6E68106EF248004B1A7F /* Plugins */,
1BA325BC10545A1B00276F57 /* App */,
Expand Down
2 changes: 1 addition & 1 deletion Release/next_release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0a16
1.0
21 changes: 16 additions & 5 deletions Scripts/plist.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
set -o errexit
set -x

#[ -n "$CONFIGURATION_TEMP_DIR" ] || CONFIGURATION_TEMP_DIR="build/MetaZ.build/Debug"
#[ -n "$TARGET_TEMP_DIR" ] || TARGET_TEMP_DIR="$CONFIGURATION_TEMP_DIR/Plist\ Marcos.build"
#[ -n "$SCRIPT_INPUT_FILE_0" ] || SCRIPT_INPUT_FILE_0="Release/next_release.txt"
#[ -n "$SCRIPT_OUTPUT_FILE_0" ] || SCRIPT_OUTPUT_FILE_0="$TARGET_TEMP_DIR/PlistMacros.h"
[ -n "$CONFIGURATION_TEMP_DIR" ] || CONFIGURATION_TEMP_DIR="build/MetaZ.build/Debug"
[ -n "$TARGET_TEMP_DIR" ] || TARGET_TEMP_DIR="$CONFIGURATION_TEMP_DIR/Plist Marcos.build"
[ -n "$SCRIPT_INPUT_FILE_0" ] || SCRIPT_INPUT_FILE_0="Release/next_release.txt"
[ -n "$SCRIPT_OUTPUT_FILE_0" ] || SCRIPT_OUTPUT_FILE_0="$TARGET_TEMP_DIR/PlistMacros.h"

PATH=$PATH:/usr/local/bin:/usr/bin:/sw/bin:/opt/local/bin
buildid=`git log -n1 --pretty=oneline --format=%h`
release=`cat "$SCRIPT_INPUT_FILE_0"`
builddate=`date +%y.%m.%d.%H`

major="$(echo $release | cut -d . -f 1 -)"
minor="$(echo $release | cut -d . -f 2 -)"

while git show-ref --tags --quiet --verify -- "refs/tags/v${major}.${minor}" ; do
((minor = $minor + 1))
done
if [[ "$TRAVIS_BRANCH" != "$TRAVIS_TAG" ]]; then
release="${major}.${minor}.beta-$TRAVIS_BUILD_NUMBER"
else
release="${major}.${minor}"
fi

if git show-ref --tags --quiet --verify -- "refs/tags/v$release"; then
TAG="v$release"
elif git show-ref --tags --quiet --verify -- "refs/tags/$release"; then
Expand All @@ -20,7 +32,6 @@ if [ -n "$TAG" -a "$TAG" != "$(git describe --exact-match --tags HEAD 2> /dev/nu
echo "Tag $TAG exists and HEAD is not on it so we can't build version $release"
exit 1
fi
env|sort
echo "#define BUILDID $buildid" > "$SCRIPT_OUTPUT_FILE_0"
echo "#define BUILDDATE $builddate" >> "$SCRIPT_OUTPUT_FILE_0"
echo "#define BUILDVERSION $builddate.$buildid" >> "$SCRIPT_OUTPUT_FILE_0"
Expand Down
17 changes: 7 additions & 10 deletions Scripts/sparkle_sign.bash
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
set -o errexit
#set -x

export KEYCHAIN_PRIVKEY_NAME="MetaZ Sparkle Private"
set -x

if [ "${CONFIGURATION}" != "Release" ]; then exit; fi
if [[ -z "$(security find-generic-password -s "$KEYCHAIN_PRIVKEY_NAME")" ]] ; then exit; fi
if [[ ! -f "sparkle_private.pem" ]] ; then
echo "No sparkle_private.pem found so skipping package sign"
exit
fi

PATH=$PATH:/usr/local/bin:/usr/bin:/sw/bin:/opt/local/bin

Expand All @@ -21,10 +22,9 @@ cd "$BUILT_PRODUCTS_DIR"

SIZE=$(stat -f %z "$ARCHIVE_FILENAME")
PUBDATE=$(date +"%a, %d %b %G %T %z")
KEY=$(security find-generic-password -g -s "$KEYCHAIN_PRIVKEY_NAME" 2>&1 1>/dev/null | perl -pe '($_) = /"(.+)"/; s/\\012/\n/g')
SIGNATURE=$(openssl dgst -sha1 -binary < "$ARCHIVE_FILENAME" | openssl dgst -dss1 -sign <(echo "$KEY") | openssl enc -base64)
SIGNATURE=$(openssl dgst -sha1 -binary < "$ARCHIVE_FILENAME" | openssl dgst -dss1 -sign <$WD/sparkle_private.pem | openssl enc -base64)

[ $SIGNATURE ] || { echo Unable to load signing private key with name "'$KEYCHAIN_PRIVKEY_NAME'" from keychain; false; }
[ $SIGNATURE ] || { echo "Unable to load signing key from sparkle_private.pem"; false; }

cat > "$PROJECT_NAME-$VERSION.xml" <<EOF
<enclosure
Expand All @@ -42,6 +42,3 @@ cat > "$PROJECT_NAME-$VERSION.json" <<EOF
"dsaSignature": "$SIGNATURE"
}
EOF

echo scp "'$HOME/svn/my-cool-app/build/Release/$ARCHIVE_FILENAME'" www.example.com:download/
echo scp "'$WD/appcast.xml'" www.example.com:web/software/my-cool-app/appcast.xml
12 changes: 12 additions & 0 deletions Scripts/tag-beta.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if [[ "$TRAVIS_BRANCH" != "$TRAVIS_TAG" ]]; then
VERSION=$(/usr/libexec/PlistBuddy -c "print :CFBundleShortVersionString" "build/Release/MetaZ.app/Contents/Info.plist")

git config --global user.email "builds@travis-ci.com"
git config --global user.name "Travis CI"
export GIT_TAG=v${VERSION}.beta-$TRAVIS_BUILD_NUMBER
echo git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
git push -q https://$GITHUB_TOKEN@github.com/griff/metaz --tags
else
echo "Skipping because build is a tag"
fi
Binary file added sparkle_private.pem.enc
Binary file not shown.

0 comments on commit dc215f6

Please sign in to comment.