Skip to content

Instantly share code, notes, and snippets.

@mand2
Created August 31, 2020 10:52
Show Gist options
  • Save mand2/277f0c526d51e6a3ca5b9270575360fa to your computer and use it in GitHub Desktop.
Save mand2/277f0c526d51e6a3ca5b9270575360fa to your computer and use it in GitHub Desktop.
Auto commit shell script for Hugo template users.
#!/bin/bash
msg_public_file={{ directory of the `public` commit message file}}
msg_blog_file={{ directory of the `blog` commit message file }}
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo
##### public repo Commit & Push #####
# Go To Public folder
cd public
# Add `changes` to git.
git add .
# Commit `changes` with custom commit messages.
msg_public=`cat $msg_public_file`
git commit -m "$msg_public"
# Push source and build repos.
git push
# Come Back up to the Project Root
cd ..
##### blog repo Commit & Push #####
# public repo에 한 것과 동일.
git add .
msg_blog=`cat $msg_blog_file`
git commit -m "$msg_blog"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment