Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build docs site with GitHub Actions #8201

Merged
merged 8 commits into from
Nov 11, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build and deploy Jekyll documentation site

on:
pull_request:
branches:
- master

env:
RUBY_VERSION: 2.7

jobs:
deploy_docs:
if: "!contains(github.event.commits[0].message, '[ci skip]')"
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: Setup cache for Bundler
id: cache
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-bundler-${{ env.RUBY_VERSION }}-${{ hashFiles('Gemfile') }}-${{ hashFiles('jekyll.gemspec') }}
DirtyF marked this conversation as resolved.
Show resolved Hide resolved
restore-keys:
- ${{ runner.os }}-bundler-${{ env.RUBY_VERSION }}-${{ hashFiles('Gemfile') }}-
- ${{ runner.os }}-bundler-${{ env.RUBY_VERSION }}-
- name: Set up dependencies
run: |
gem update --system --no-document
gem update bundler --no-document
DirtyF marked this conversation as resolved.
Show resolved Hide resolved
bundle install --path=vendor/bundle --jobs 4 --retry 3
bundle clean
- name: Build site
run: bundle exec jekyll build --source docs --destination docs/_site --verbose --trace
env:
JEKYLL_PAT: ${{ secrets.GITHUB_TOKEN }}
iBug marked this conversation as resolved.
Show resolved Hide resolved
- name: Deploy to GitHub Pages
run: |
SOURCE_COMMIT="$(git log -1 --pretty="%an: %B" "$GITHUB_SHA")"
pushd docs/_site &>/dev/null
: > .nojekyll

REMOTE_REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
REMOTE_BRANCH="${REMOTE_BRANCH:-gh-pages}"

echo "Publishing to ${GITHUB_REPOSITORY} on branch ${REMOTE_BRANCH}"
git init --quiet
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add --all
git commit --quiet \
--message "Deploy docs from ${GITHUB_SHA}" \
--message "$SOURCE_COMMIT"
git push "$REMOTE_REPO" "+HEAD:${REMOTE_BRANCH}"

popd &>/dev/null