Created
January 14, 2016 13:04
-
-
Save nagelflorian/2e7509750d1254a1549a to your computer and use it in GitHub Desktop.
CircleCI File for Meteor using Velocity with Jasmine and Galaxy for deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
node: | |
version: 0.10.40 | |
pre: | |
# download if meteor isn't already installed in the cache | |
- meteor || curl https://install.meteor.com | /bin/sh | |
post: | |
- meteor --version | |
checkout: | |
post: | |
- git submodule sync | |
- git submodule update --init --recursive | |
dependencies: | |
override: | |
- npm install -g velocity-cli | |
test: | |
override: | |
- echo $METEOR_SETTINGS > settings.json | |
- rm -rf tests/jasmine/client | |
- velocity test-app --ci --settings settings.json | |
deployment: | |
staging: | |
branch: "production" | |
commands: | |
- meteor add meteorhacks:kadira | |
- echo $METEOR_TOKEN > deployment_token.json | |
- echo METEOR_SETTINGS_STAGING > settings.json | |
# The content of the METEOR_SESSION_FILE is generated with: | |
# 'METEOR_SESSION_FILE=deployment_token.json meteor login' | |
- DEPLOY_HOSTNAME=galaxy.meteor.com METEOR_SESSION_FILE=deployment_token.json meteor deploy $METEOR_TARGET --settings settings.json |
Try this METEOR_SESSION_FILE=deployment_token.json meteor login
Thanks for posting this, I found it useful and have extended it a little.
FWIW, I prefer to encode the string to Base64 first. While Circle supports multi-line environment variables, some CI servers don't so here's how you do it when that's the case.
Start by getting the session file as above:
METEOR_SESSION_FILE=meteor-session-file.json meteor login
Then load the file into an environment variable and use node.js to convert the file content to a BASE64 string:
FILE_CONTENT=`cat meteor-session-file.json` node -e "console.log(new Buffer(process.env.FILE_CONTENT).toString('base64'))"
Copy and paste the BASE64 string into an environment variable field called METEOR_SESSION_FILE_CONTENT
in your CI server.
Then when you're creating the file, you can use this:
deployment:
...
- node -e "console.log(new Buffer(process.env.METEOR_SESSION_FILE, 'base64').toString('utf-8'))" > deployment_token.json
...
- DEPLOY_HOSTNAME=galaxy.meteor.com METEOR_SESSION_FILE=deployment_token.json meteor deploy $METEOR_TARGET
Hope that helps someone
@samhatoum since JSON doesn't require whitespace you could simply remove it:
{
"valid": true,
"foo": "bar"
}
Becomes:
{"valid":true,"foo":"bar"}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how did you generate the
deployment_token.json
file ? what does that file look like (or supposed to look like)?