build live site #4
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: build-site | |
run-name: build live site | |
on: | |
# run when called from another workflow | |
workflow_call: | |
# run if user manually requests it | |
workflow_dispatch: | |
# variables | |
env: | |
PREVIEWS_FOLDER: preview | |
permissions: | |
contents: write | |
jobs: | |
build-site: | |
runs-on: ubuntu-latest | |
steps: | |
# for debugging | |
- name: Print contexts | |
uses: crazy-max/ghaction-dump-context@v1 | |
- name: Checkout branch contents | |
uses: actions/checkout@v3 | |
- name: Install Ruby packages | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" | |
bundler-cache: true | |
- name: Get Pages url | |
id: pages | |
uses: actions/configure-pages@v2 | |
with: | |
enablement: false | |
- name: Build live version of site | |
run: | | |
JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}" | |
- name: Commit live site to Pages branch | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: _site | |
clean-exclude: ${{ env.PREVIEWS_FOLDER }} | |
force: false |