Skip to content

Commit

Permalink
add patch to clean gh-pages before committing (carpentries#545)
Browse files Browse the repository at this point in the history
This will address carpentries#544
  • Loading branch information
zkamvar authored Feb 10, 2021
1 parent 5bc7724 commit d021e1f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ jobs:
- name: Commit and Push
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
run: |
# clean up gh-pages
cd gh-pages
git rm -rf . # remove all previous files
git restore --staged . # remove things from the stage
cd ..
# copy everything into gh-pages site
cp -r `ls -A | grep -v 'gh-pages' | grep -v '.git' | grep -v '.bundle/' | grep -v '_site'` gh-pages
# move into gh-pages, add, commit, and push
Expand All @@ -105,7 +110,7 @@ jobs:
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add -A .
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }}"
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
git push origin gh-pages
# return
cd ..
Expand Down

0 comments on commit d021e1f

Please sign in to comment.