Push website to gh-pages branch #64
Workflow file for this run
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: Push website to gh-pages branch | |
on: | |
push: | |
paths: | |
- 'website/**/*' | |
- '.github/workflows/gh-pages.yml' | |
branches: | |
- 'main' | |
# workflow_call: | |
release: | |
types: [published, unpublished, edited] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
push-to-gh-pages: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
working-directory: website | |
- name: Build site | |
run: | | |
cd website | |
bundle exec jekyll build | |
cd .. | |
- name: Push website directory as subtree to branch gh-pages | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add -f website/_site | |
git commit -m "Website build" | |
git subtree split --branch gh-pages --prefix website/_site/ | |
git push origin gh-pages --force | |