Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deploy scripts for namecoin.org website. #202

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions _scripts/deploy_beta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
set -eu -o pipefail
shopt -s failglob

DEPLOY_GHPAGES=0

echo "You've already deployed to the github.io site, right?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) DEPLOY_GHPAGES=1; break;;
esac
done

if [[ "${DEPLOY_GHPAGES}" == "1" ]]
then
echo ""
echo "Deploying to github.io..."
echo ""
bash ./deploy_ghpages.sh
echo ""
echo "Is everything working properly at github.io?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit 1;;
esac
done
fi

echo ""

if [[ "$(pwd)" == */namecoin.org/_scripts ]]
then
pushd ../../
else
if [[ "$(pwd)" == */namecoin.org ]]
then
pushd ../
else
pushd ./
fi
fi

# This script is tested and 100% working.

pushd namecoin.info
git fetch origin
git checkout beta
git merge origin/beta
OLD_REVISION=$(git log -1 --format=oneline | grep -oE '[^ ]+$')
echo "$OLD_REVISION" | grep -E -e '\b([a-f0-9]{40})\b' -
popd
pushd namecoin.org
git fetch origin
git checkout master
git merge origin/master
COMMITS_TO_TEST=$(git shortlog --no-merges $OLD_REVISION..master)
JEKYLL_REVISION="$(git rev-parse --verify master)"
echo "$JEKYLL_REVISION" | grep -E -e '\b([a-f0-9]{40})\b' -
popd
JEKYLL_VM=offline-namecoin-jekyll-deploy
qvm-copy-to-vm "$JEKYLL_VM" ./namecoin.org

echo ""
echo "Open a terminal in the Jekyll VM, and run the following:"
echo "bash ~/QubesIncoming/anon-13-git-github-wip/namecoin.org/_scripts/deploy_jekyll_vm.sh"
read -p "Press Enter when you've done this."

rm -rf ./namecoin.info/*
JEKYLL_BUILT_FILES="$HOME""/QubesIncoming/""$JEKYLL_VM""/_site/*"
cp -a $JEKYLL_BUILT_FILES ./namecoin.info/
rm -rf "$HOME""/QubesIncoming/""$JEKYLL_VM""/_site"
pushd namecoin.info
git add .
git commit --message="Updated based on Jekyll build of $JEKYLL_REVISION"
git push origin beta
git checkout master
popd

popd

echo ""
echo "Finished! The results should be available within 1 hour at:"
echo "https://beta.namecoin.org/"
echo "Check the website to make sure that the following commits are working as intended:"
echo "$COMMITS_TO_TEST"
35 changes: 35 additions & 0 deletions _scripts/deploy_ghpages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
set -euf -o pipefail

if [[ "$(pwd)" == */namecoin.org/_scripts ]]
then
pushd ../../
else
if [[ "$(pwd)" == */namecoin.org ]]
then
pushd ../
else
pushd ./
fi
fi

# This script is tested and 100% working.

pushd namecoin.org
git fetch origin
COMMITS_TO_TEST=$(git shortlog --no-merges gh-pages..origin/master)
git checkout master
git merge origin/master
git checkout gh-pages
git merge origin/gh-pages
git merge master
git push origin gh-pages
git checkout master
popd

popd

echo ""
echo "The results should be available within a few seconds at:"
echo "https://namecoin.github.io/namecoin.org/"
echo "Check the website to make sure that the following commits are working as intended:"
echo "$COMMITS_TO_TEST"
11 changes: 11 additions & 0 deletions _scripts/deploy_jekyll_vm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set -euf -o pipefail

cd ~/QubesIncoming/anon-13-git-github-wip/

pushd namecoin.org
jekyll build
qvm-copy-to-vm anon-13-git-github-wip ./_site
popd
rm -rf namecoin.org

sudo poweroff
63 changes: 63 additions & 0 deletions _scripts/deploy_public.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
set -euf -o pipefail

DEPLOY_BETA=0

echo "You've already deployed to the beta site, right?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) DEPLOY_BETA=1; break;;
esac
done

if [[ "${DEPLOY_BETA}" == "1" ]]
then
echo ""
echo "Deploying to beta..."
echo ""
bash ./deploy_beta.sh
echo ""
echo "Is everything working properly at beta?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit 1;;
esac
done
fi

echo ""

if [[ "$(pwd)" == */namecoin.org/_scripts ]]
then
pushd ../../
else
if [[ "$(pwd)" == */namecoin.org ]]
then
pushd ../
else
pushd ./
fi
fi

# This script is tested and 100% working.

pushd namecoin.info
git fetch origin
git checkout beta
git merge origin/beta
git checkout master
git merge origin/master
git merge beta
git push origin master
popd

popd

echo ""
echo "Finished! The results should be available within 1 hour at:"
echo "https://www.namecoin.org/"
echo ""
echo "If needed, post about the change on:"
echo "* Reddit"
echo "* Twitter"