Skip to content

Instantly share code, notes, and snippets.

@nitinja
Created February 19, 2017 17:39
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 nitinja/47aed999836e2644629cf0347656a47f to your computer and use it in GitHub Desktop.
Save nitinja/47aed999836e2644629cf0347656a47f to your computer and use it in GitHub Desktop.
script to bundle & deploy Javascript apps to remote server using npm
#!/bin/bash
#Get app version
APP_VERSION=$(node -pe "require('./package.json').version")
#create a name for your bundle
ARCHIVE_NAME='app-name-'$APP_VERSION'.tar.gz'
#create an archive
tar -czvf $ARCHIVE_NAME -C ./dist .
#deploy to server
curl -u username:password -X PUT "http://jenkins.myserver.com:8081/artifactory/libs-release-local/com/myserver/myproject/$APP_VERSION/$ARCHIVE_NAME" -T ./$ARCHIVE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment