Skip to content

Instantly share code, notes, and snippets.

@lordoftheflies
Last active March 24, 2017 13:50
Show Gist options
  • Save lordoftheflies/e313b84e922f9f9cf00dac771da45150 to your computer and use it in GitHub Desktop.
Save lordoftheflies/e313b84e922f9f9cf00dac771da45150 to your computer and use it in GitHub Desktop.
HTML5 project distribution integration to WAR
GITHUB_TOKEN=401288238effd624025ae2060c2070a36f18d0bc
USER=lordoftheflies
REPOSITORY=hedgehog-rmd-frontend
HTML5_DIST=hedgehog-rmd-frontend.tar.gz
STATIC_RESOURCES=hedgehog-rmd-app/src/main/resources/static
DOWNLOAD_URL=$(curl -L -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$USER/$REPOSITORY/releases/latest | grep "/releases/assets/" | sed s/\"url\":\ //g | sed s/\"//g | sed s/\,//g | sed 's: ::g')
git checkout master
curl -vLJO -H 'Accept: application/octet-stream' ${DOWNLOAD_URL}?access_token=$GITHUB_TOKEN
mkdir -p $STATIC_RESOURCES
tar xvzf $HTML5_DIST -C $STATIC_RESOURCES
rm $HTML5_DIST
git add .
git diff --quiet --exit-code --cached || git commit -am "Polymer build packaging of $REPOSITORY."
git push origin master
echo "Polymer resources added."
GITHUB_TOKEN=401288238effd624025ae2060c2070a36f18d0bc
USER=lordoftheflies
REPOSITORY=hedgehog-rmd-frontend
git tag $BUILD_ID
git push --tags
tar -zcvf $REPOSITORY.tar.gz -C ./build/bundled
github-release release --security-token $GITHUB_TOKEN --user $USER --repo $REPOSITORY --tag $BUILD_ID --name "Release $BUILD_ID" --description "Release from [Jenkins build]($BUILD_URL)"
github-release upload --security-token $GITHUB_TOKEN --user $USER --repo $REPOSITORY --tag $BUILD_ID --name "$REPOSITORY.tar.gz" --file $REPOSITORY.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment