Skip to content

Instantly share code, notes, and snippets.

@SamuelDavis
Created December 24, 2021 08:49
Show Gist options
  • Save SamuelDavis/d0355b0f80afb685d9be421b4db5c110 to your computer and use it in GitHub Desktop.
Save SamuelDavis/d0355b0f80afb685d9be421b4db5c110 to your computer and use it in GitHub Desktop.
Deploy Script for NPM projects with a `build` command which generate a `/dist` directory.
#!/usr/bin/env sh
NAME='repo'
# abort on errors
set -e
# build
npm run build
# navigate into the build output directory
cd dist
# if you are deploying to a custom domain
echo "${NAME}.sdavis.online" > CNAME
git init
git add -A
git commit -m 'deploy'
git push -f git@github.com:SamuelDavis/${NAME}.git master:gh-pages
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment