Commit 7ccd1a77 authored by Aral Balkan's avatar Aral Balkan

Now not overwriting on better/edit if file exists in content. Closes #9.

parent cf304e13
Pipeline #497 skipped
......@@ -259,17 +259,25 @@ createBranch(){
echo " · Creating branch ${branchName}."
runIn $contentDirectory "git checkout -b $branchName"
echo " · Copying ${domain} from drafts/${category} to content/${category} in ${branchName}."
cp -R ~/better.fyi/drafts/$category/$domain ~/better.fyi/content/$category/
#
# Add, commit, and push the newly-added draft and the branch itself to the live repository.
# Check if the directory already exists in content and, if it doesn’t, copy the draft.
#
echo " · Adding changes to git."
runIn $contentDirectory "git add --all"
local targetDirectory=~/better.fyi/content/$category
if [ -d $targetDirectory ]; then
echo " · Content already exists at ${targetDirectory}, not copying."
else
#
# Copy, add, commit, and push the newly-added draft and the branch itself to the live repository.
#
echo " · Copying ${domain} from drafts/${category} to content/${category} in ${branchName}."
cp -R ~/better.fyi/drafts/$category/$domain ~/better.fyi/content/$category/
echo " · Committing changes to git."
runIn $contentDirectory "git commit -am \"Added ${domain} draft to ${category}. Progress towards #${issueIID}.\""
echo " · Adding changes to git."
runIn $contentDirectory "git add --all"
echo " · Committing changes to git."
runIn $contentDirectory "git commit -am \"Added ${domain} draft to ${category}. Progress towards #${issueIID}.\""
fi
echo " · Pushing the newly-created branch to the repository at https://source.ind.ie/better/content"
runIn $contentDirectory "git push --set-upstream live ${branchName}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment