Skip to content

Instantly share code, notes, and snippets.

@chaosmail
Created August 15, 2017 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaosmail/f3f2784b9e32f1c78894d63bf1ae2d45 to your computer and use it in GitHub Desktop.
Save chaosmail/f3f2784b9e32f1c78894d63bf1ae2d45 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
currentVersion=`cat package.json | grep version | sed 's/[",:]//g' | awk '{print $2}'`
npm install
npm run compile
git checkout --orphan "build-$currentVersion"
find . -maxdepth 1 -type d -not -name "build" -not -name "docs" -not -name ".*" -exec rm -rf {} \;
find . -maxdepth 1 -type f -not -name "LICENSE" -not -name "README.md" -exec rm -f {} \;
git add .
git commit -a -m 'Update build files'
git push -f origin "build-$currentVersion"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment