Created
January 24, 2019 11:47
-
-
Save pheuberger/ca0d63862049ee533d1cb317d6e1de30 to your computer and use it in GitHub Desktop.
CI/CD script with the serverless framework on IBM Cloud DevOps toolchain
This file contains 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
#!/bin/bash | |
ibmcloud api --unset | |
# Login to ibmcloud, generate .wskprops | |
ibmcloud login --apikey $IBMCLOUD_API_KEY -a $API_ENDPOINT | |
ibmcloud target -o "$ORG" -s "$SPACE" | |
ibmcloud fn api list > /dev/null | |
echo 'Updating node and npm' | |
export NODE_VERSION=10.8.0 | |
export NVM_VERSION=0.34.0 | |
npm config delete prefix \ | |
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}/install.sh | bash \ | |
&& export NVM_DIR="$HOME/.nvm" \ | |
&& . $NVM_DIR/nvm.sh \ | |
&& nvm install $NODE_VERSION \ | |
&& nvm alias default $NODE_VERSION \ | |
&& nvm use default \ | |
&& node -v \ | |
&& npm -v | |
echo 'Installing dependencies...' | |
npm install | |
npm i serverless -g | |
echo 'Running tests...' | |
npm test | |
echo 'Deploying API' | |
sls deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment