Compare commits

...

10 commits

Author SHA1 Message Date
Waylon Walker
2e4e82e4f2
Update pages.yml
Some checks failed
CI / build (push) Failing after 1s
2020-03-22 16:01:34 -05:00
Waylon Walker
17bb90e935
Update pages.yml 2020-03-22 15:59:24 -05:00
Waylon Walker
bb76c07e6c
Update pages.yml 2020-03-22 15:58:12 -05:00
Waylon Walker
e75f2d96df
Update pages.yml 2020-03-22 15:55:53 -05:00
Waylon Walker
af64417ccf
Update pages.yml 2020-03-09 22:23:39 -05:00
Waylon Walker
055c685813
Update pages.yml 2020-03-09 22:22:43 -05:00
Waylon Walker
5f5f692225
Update pages.yml 2020-03-09 22:17:14 -05:00
Waylon Walker
c8fef74bc6
Update pages.yml 2020-03-09 22:11:45 -05:00
Waylon Walker
82f03a9ebd
Update pages.yml 2020-03-09 22:10:40 -05:00
Waylon Walker
0989c008ab
Update pages.yml 2020-03-09 22:09:06 -05:00

View file

@ -1,3 +1,7 @@
env: &anchor
ANCHOR: this is my anchor
name: CI
on:
push:
@ -8,56 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- env:
<<: *anchor
- name: push content
run: |
REMOTE="https://${GITHUB_PAT}@github.com/${GITHUB_REPOSITORY}.git"
COMMITER_NAME="${GITHUB_ACTOR}-github-actions"
COMMITER_EMAIL="${GITHUB_ACTOR}-@users.noreply.github.com"
REMOTE_BRANCH_EXISTS=$(git ls-remote --heads ${REMOTE} ${target_branch} | wc -l)
mkdir /tmp/github-pages
cd /tmp/github-pages
if $keep_history && [ $REMOTE_BRANCH_EXISTS -ne 0 ]
then
git clone --quiet --branch ${target_branch} --depth 1 ${REMOTE} .
else
echo remote does not exist
echo initialize repo
git init .
git checkout --orphan gh-pages
fi
echo "<h1>hello there</h1><p>stranger</p>" > index.html
DIRTY=$(git status --short | wc -l)
if $keep_history && [ $REMOTE_BRANCH_EXISTS -ne 0 ] && [ $DIRTY = 0 ]
then
echo '⚠️ There are no changes to commit, stopping.'
else
git log
git config user.name ${COMMITER_NAME}
git config user.email ${COMMITER_EMAIL}
git add --all .
git commit -m "DIST to ${target_branch}"
echo 🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo
if [ $keep_history == false]
then
git push --quiet ${REMOTE} ${target_branch}
else
git push --quiet --force ${REMOTE} ${target_branch}
fi
fi
echo 🎉 Content of ${build_dir} has been deployed to GitHub Pages.
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
target_branch: gh-pages
keep_history: true
echo ${{ env.ANCHOR }}