Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
78 lines (70 sloc) 5.65 KB
box: floydpink/ubuntu-install-builder
- script:
name: create a release, tag and push the installers to the website
code: |-
DEPLOY_READY_BRANCH=$(head -n 1 branch)
VERSION=`echo ${DEPLOY_READY_BRANCH} | cut -d'-' -f 2`
BARE_VERSION=`echo ${VERSION} | cut -c 2-`
echo "0. Install zip and unzip"
sudo apt-get update
sudo apt-get install zip unzip -y
echo "1. Create a new release on GitHub using the tag created from the Mac CI build (Travis CI)"
echo "1.1 Downloading jq"
wget ""
chmod +x jq
echo "1.2 Cloning the website repo"
mkdir ${VERSION}
mkdir installerRepo && cd $_
git clone $WEBSITE_REPO
git config credential.helper "store --file=.git/fd-credentials"
echo "https://${GH_TOKEN}" > .git/fd-credentials
git config push.default tracking
PREVIOUS_VERSION=$(head -n 1 app/build.number)
echo "1.3 Copying the new installers to a separate directory"
cp -r ./app/installer/* ../../${VERSION}
cd ../..
echo "1.4 Deleting the git directory, dependecies and previous version installers"
rm -rf ${VERSION}/**/.git* ${VERSION}/**/dependencies
rm ${VERSION}/linux/flickrdownloadr-${PREVIOUS_VERSION} ${VERSION}/linux-x64/flickrdownloadr-${PREVIOUS_VERSION}-0.x86_64.rpm ${VERSION}/linux-x64/flickrdownloadr-${PREVIOUS_VERSION} ${VERSION}/linux-x64/flickrdownloadr_${PREVIOUS_VERSION}-0_amd64.deb "${VERSION}/osx/Install flickr downloadr (v${PREVIOUS_VERSION}).dmg" ${VERSION}/windows/flickrdownloadr-${PREVIOUS_VERSION}-windows-installer.exe
echo "1.5 Zipping the release assets"
zip -r ./linux-x64
zip -r ./linux
zip -r ./osx
zip -r ./windows
echo "1.6 Creating the release"
RELEASE_JSON_PAYLOAD=$(printf '{ "tag_name": "%s", "name": "%s" }' $VERSION $VERSION)
echo "1.7 Uploading the release assets"
UPLOAD_URL=$(curl --user ${GH_TOKEN}:x-oauth-basic --request POST --data "${RELEASE_JSON_PAYLOAD}" | ../jq -r '.upload_url')
if [[ ${UPLOAD_URL} != */assets{?name,label} ]]; then exit 100; fi
UPLOAD_URL_WITH_NAME=$(echo $UPLOAD_URL | sed 's/{?name,label}$/\?name=/')
curl --request POST --user ${GH_TOKEN}:x-oauth-basic --header "Content-Type:application/zip" --data-binary "${UPLOAD_URL_WITH_NAME}"
curl --request POST --user ${GH_TOKEN}:x-oauth-basic --header "Content-Type:application/zip" --data-binary "${UPLOAD_URL_WITH_NAME}"
curl --request POST --user ${GH_TOKEN}:x-oauth-basic --header "Content-Type:application/zip" --data-binary "${UPLOAD_URL_WITH_NAME}"
curl --request POST --user ${GH_TOKEN}:x-oauth-basic --header "Content-Type:application/zip" --data-binary "${UPLOAD_URL_WITH_NAME}"
echo "2. Delete previous installers on${SOURCE_BRANCH}"
cd ../installerRepo/
git checkout $SOURCE_BRANCH
git rm --ignore-unmatch app/installer/linux/flickrdownloadr-${PREVIOUS_VERSION} app/installer/linux-x64/flickrdownloadr-${PREVIOUS_VERSION}-0.x86_64.rpm app/installer/linux-x64/flickrdownloadr-${PREVIOUS_VERSION} app/installer/linux-x64/flickrdownloadr_${PREVIOUS_VERSION}-0_amd64.deb "app/installer/osx/Install flickr downloadr (v${PREVIOUS_VERSION}).dmg" app/installer/windows/flickrdownloadr-${PREVIOUS_VERSION}-windows-installer.exe
echo "3. Add current installers to${SOURCE_BRANCH}"
cp -r ../../${VERSION}/* ./app/installer
git add app/installer/linux/flickrdownloadr-${BARE_VERSION} app/installer/linux-x64/flickrdownloadr-${BARE_VERSION}-0.x86_64.rpm app/installer/linux-x64/flickrdownloadr-${BARE_VERSION} app/installer/linux-x64/flickrdownloadr_${BARE_VERSION}-0_amd64.deb "app/installer/osx/Install flickr downloadr (v${BARE_VERSION}).dmg" app/installer/windows/flickrdownloadr-${BARE_VERSION}-windows-installer.exe
echo "4. Update build.number file to the latest version on${SOURCE_BRANCH}"
echo -n $BARE_VERSION > app/build.number
echo "5. Commit and push all changes to GitHub"
git config --global "The CI Bot"
git config --global ""
git commit -asm "Published version ${VERSION} to the website"
git push origin $SOURCE_BRANCH
echo "6. Delete the deploy branch on GitHub"
git push origin :$DEPLOY_READY_BRANCH
echo "7. Just keep the build.number file alone for the output directory"
cp app/build.number "${WERCKER_OUTPUT_DIR}/"