Skip to content

Instantly share code, notes, and snippets.

@rjbultitude
Created November 19, 2019 12:22
Show Gist options
  • Select an option

  • Save rjbultitude/879d044fb359a7ad8c945c2b2bc7d624 to your computer and use it in GitHub Desktop.

Select an option

Save rjbultitude/879d044fb359a7ad8c945c2b2bc7d624 to your computer and use it in GitHub Desktop.

Revisions

  1. rjbultitude created this gist Nov 19, 2019.
    18 changes: 18 additions & 0 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #/bin/bash
    npm run build

    # get the current branch name and create a directory destination using it
    dest_dir="project-dir/$(git rev-parse --abbrev-ref HEAD)"

    # make the destination directory
    mkdir -p $dest_dir

    # copy the web build
    cp -R public/build/ $dest_dir

    # commit and push changes
    cd project-dir
    git add .
    git commit -m "new deployment at ${date}"
    git pull
    git push