Last active
April 19, 2017 13:10
-
-
Save suda/398b4fdf5a7fced71564ee0fe2fcbc57 to your computer and use it in GitHub Desktop.
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 | |
if [[ -z $ACCESS_TOKEN ]]; then | |
echo "Please set ACCESS_TOKEN env variable" | |
exit -1 | |
fi | |
if [[ -z $PARTICLE_VERSION ]]; then | |
PARTICLE_VERSION=0.6.1 | |
echo "Defaulted to version 0.6.1" | |
fi | |
if [[ -z $PARTICLE_PLATFORM ]]; then | |
PARTICLE_PLATFORM=photon | |
PARTICLE_PLATFORM_ID=6 | |
echo "Defaulted to photon" | |
else | |
if [[ -z $PARTICLE_PLATFORM_ID ]]; then | |
echo "Please specify PARTICLE_PLATFORM_ID as well" | |
exit -2 | |
fi | |
fi | |
# Copy current directory to a temporary directory | |
cp -r $PWD /tmp/workspace | |
# Remove .git directory | |
rm -rf /tmp/workspace/.git | |
# Preprocess .ino files | |
docker run --rm -v /tmp/workspace:/input -v /tmp/workspace:/output particle/buildpack-wiring-preprocessor | |
# Install dependecies | |
docker run --rm -v /tmp/workspace:/input -v /tmp/workspace:/output -e ACCESS_TOKEN=$ACCESS_TOKEN particle/buildpack-install-dependencies | |
# Compile against 0.6.1 for Photon | |
docker run --rm -v /tmp/workspace:/input -v $PWD/build:/output -e PLATFORM_ID=$PARTICLE_PLATFORM_ID particle/buildpack-particle-firmware:$PARTICLE_VERSION-$PARTICLE_PLATFORM | |
# Remove the workspace | |
rm -rf /tmp/workspace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment