Skip to content

Commit

Permalink
Custom script to publish releases to GCS
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickael Alliel committed Jul 18, 2019
1 parent 692816b commit 97ee3ee
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 822 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
brew cleanup
# wine is required to sign windows executables
(brew install wine || brew install wine)
# install gcloud sdk
curl https://sdk.cloud.google.com | bash
source ~/.bash_profile
# download custom jsign to sign PE
curl -fsSL https://get.rookout.com/jsign-rookout.jar --output jsign.jar
# install yarn
Expand All @@ -45,8 +48,11 @@ jobs:
# Save gcloud credentials service account
echo $GOOGLE_SERVICE_ACCOUNT_KEY_BASE64 | base64 --decode > gcloud_service_account.json
export GOOGLE_APPLICATION_CREDENTIALS=gcloud_service_account.json
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
# package code for every distribution (mac,win,linux) and publish as github release
yarn run mac-publish
# publish in google storage bucket (additionally to electronbuild-publisher)
bash upload_release_to_gs.sh
- save_cache:
key: homebrew-cache-{{ checksum ".circleci/config.yml" }}
paths:
Expand Down
14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "explorook",
"version": "1.0.3",
"version": "1.0.4",
"description": "Rookout's site addon to support local files and folders",
"main": "dist/index.js",
"scripts": {
Expand All @@ -24,10 +24,6 @@
"provider": "github",
"owner": "rookout",
"repo": "explorook"
},
{
"provider": "generic",
"url": "https://get.rookout.com/${name}/${os}/${arch}/${version}"
}
],
"directories": {
Expand Down Expand Up @@ -62,13 +58,6 @@
"icon": "assets/icons/[email protected]"
}
},
"publish-gcs": {
"bucket": "get.rookout.com",
"path": "/${name}/${os}/${arch}/${filename}/${version}",
"serviceAccount": "/Users/distiller/project/gcloud_service_account.json",
"public": true,
"resumable": false
},
"repository": "https://github.com/rookout/explorook",
"keywords": [
"Rookout",
Expand Down Expand Up @@ -97,7 +86,6 @@
"electron": "^2.0.8",
"electron-builder": "^20.19.2",
"electron-builder-lib": "^20.15.3",
"electron-publisher-gcs": "^0.1.5",
"graphql-middleware": "^2.0.2",
"tslint": "^5.10.0",
"typescript": "^2.8.3"
Expand Down
37 changes: 37 additions & 0 deletions upload_release_to_gs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -e

VERSION=$(cat /Users/distiller/project/package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')

BUCKET="get.rookout.com"
INSTALLERS_DIR="/Users/distiller/project/installers/"

WINDOWS_FILE_NAME="Explorook Setup ${VERSION}.exe"
WINDOWS_NO_SPACE_FILE_NAME="explorook-setup-${VERSION}.exe"
MAC_DMG_FILE_NAME="Explorook-${VERSION}.dmg"
MAC_ZIP_FILE_NAME="Explorook-${VERSION}.zip"
LINUX_FILE_NAME="explorook-${VERSION}-x86_64.AppImage"


echo "Starting upload to Google Storage Bucket: ${BUCKET}"
echo "Uploading Windows Installer..."
gsutil cp "${INSTALLERS_DIR}${WINDOWS_FILE_NAME}" "gs://${BUCKET}/explorook/windows/${WINDOWS_NO_SPACE_FILE_NAME}"
gsutil acl ch -u AllUsers:R "gs://${BUCKET}/explorook/windows/${WINDOWS_NO_SPACE_FILE_NAME}"

echo "Uploading Mac Installers (DMG+ZIP)..."
gsutil cp "${INSTALLERS_DIR}${MAC_DMG_FILE_NAME}" "gs://${BUCKET}/explorook/mac/${MAC_DMG_FILE_NAME}"
gsutil acl ch -u AllUsers:R "gs://${BUCKET}/explorook/mac/${MAC_DMG_FILE_NAME}"

gsutil cp "${INSTALLERS_DIR}${MAC_ZIP_FILE_NAME}" "gs://${BUCKET}/explorook/mac/${MAC_ZIP_FILE_NAME}"
gsutil acl ch -u AllUsers:R "gs://${BUCKET}/explorook/mac/${MAC_ZIP_FILE_NAME}"

echo "Uploading Linux Installer..."
gsutil cp "${INSTALLERS_DIR}${LINUX_FILE_NAME}" "gs://${BUCKET}/explorook/linux/${LINUX_FILE_NAME}"
gsutil acl ch -u AllUsers:R "gs://${BUCKET}/explorook/linux/${LINUX_FILE_NAME}"

echo "Uploaded release successfully to ${BUCKET} !"
3 changes: 2 additions & 1 deletion validate_version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

# Get current version from package.json file
CURRENT_VERSION="$(node -e 'console.log(require("./package").version)')"
Expand All @@ -15,4 +16,4 @@ echo "a release tag with version $CV_WITH_V already exists - updating version an
npm version patch -m "Bumping patch version after CI version conflict" && git push && \
exit 1

echo 'no version conflicts found'
echo 'no version conflicts found'
Loading

0 comments on commit 97ee3ee

Please sign in to comment.