Merge pull request #10 from SitongShang1958/lab09 #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-gh-pages | |
on: | |
push: | |
branch: main | |
jobs: | |
gh-pages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare _site | |
run: | | |
echo generate main html page in _site/ | |
mkdir _site | |
- name: Generate main page | |
run: | | |
cp .assets/template.html _site/index.html | |
cp .assets/style.css _site/ | |
npx [email protected] --gfm -i README.md >> _site/index.html | |
cat .assets/template_end.html >> _site/index.html | |
mkdir _site/assignments | |
cp learninggoals.html _site/ | |
- name: Push to gh-pages | |
run: | | |
git clone --quiet --branch gh-pages --depth 1 https://github.com/${{ github.repository }}.git .gh-pages | |
rm -rf .gh-pages/* | |
mv _site/* .gh-pages | |
cd .gh-pages | |
git add . | |
touch .nojekyll | |
git add .nojekyll | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit --allow-empty -m "Update gh-pages for ${{ github.sha }}" | |
git push https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:gh-pages --force --follow-tags -v |