Skip to content

Instantly share code, notes, and snippets.

@suda
Last active April 19, 2017 13:10
Show Gist options
  • Save suda/398b4fdf5a7fced71564ee0fe2fcbc57 to your computer and use it in GitHub Desktop.
Save suda/398b4fdf5a7fced71564ee0fe2fcbc57 to your computer and use it in GitHub Desktop.
#!/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