Skip to content

Commit

Permalink
enable pushing to gh-pages branch
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Wei committed Apr 19, 2020
1 parent b315097 commit 8cbc37c
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# exit when any command fails
set -e

echo "REPO: $GITHUB_REPOSITORY"
Expand All @@ -19,20 +20,20 @@ locale-gen zh_CN.UTF-8 && \
echo '=================== Building blog ==================='
cd pelican_dir && make publish

# TODO
# echo '=================== Publish to GitHub Pages ==================='
# remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
# remote_branch=${GH_PAGES_BRANCH:=gh-pages}
# git init
# git remote add deploy "$remote_repo"
# git checkout $remote_branch || git checkout --orphan $remote_branch
# git config user.name "${GITHUB_ACTOR}"
# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# git add .
# echo -n 'Files to Commit:' && ls -l | wc -l
# timestamp=$(date +%s%3N)
# git commit -m "[ci skip] Automated deployment to GitHub Pages on $timestamp"
# git push deploy $remote_branch --force
# rm -fr .git
# cd ../
# echo '=================== Done ==================='

echo '=================== Publish to GitHub Pages ==================='
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
remote_branch=${GH_PAGES_BRANCH:=gh-pages}
git init
git remote add deploy "$remote_repo"
git checkout $remote_branch || git checkout --orphan $remote_branch
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
echo -n 'Files to Commit:' && ls -l | wc -l
timestamp=$(date +%s%3N)
git commit -m "[ci skip] Automated deployment to GitHub Pages on $timestamp"
git push deploy $remote_branch --force
rm -fr .git
cd ../
echo '=================== Done ==================='

0 comments on commit 8cbc37c

Please sign in to comment.