Bump actions/checkout from 3 to 4 (#528) #20
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 and deploy Documentation site | |
on: | |
push: | |
branches: | |
- master | |
env: | |
RUBY_VERSION: 2.7 | |
# For control over build environment | |
DOCS_DEPLOY: true | |
jobs: | |
deploy_docs: | |
runs-on: "ubuntu-latest" | |
env: | |
BUNDLE_PATH: "vendor/bundle" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- name: Clone target branch | |
run: | | |
REMOTE_BRANCH="${REMOTE_BRANCH:-gh-pages}" | |
REMOTE_REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
echo "Publishing to ${GITHUB_REPOSITORY} on branch ${REMOTE_BRANCH}" | |
rm -rf docs/_site/ | |
git clone --depth=1 --branch="${REMOTE_BRANCH}" --single-branch --no-checkout \ | |
"${REMOTE_REPO}" docs/_site/ | |
- name: Build site | |
run: bundle exec jekyll build --source docs --destination docs/_site --verbose --trace | |
- name: Deploy to GitHub Pages | |
run: | | |
SOURCE_COMMIT="$(git log -1 --pretty="%an: %B" "$GITHUB_SHA")" | |
pushd docs/_site &>/dev/null | |
: > .nojekyll | |
git add --all | |
git -c user.name="${GITHUB_ACTOR}" -c user.email="${GITHUB_ACTOR}@users.noreply.github.com" \ | |
commit --quiet \ | |
--message "Deploy docs from ${GITHUB_SHA}" \ | |
--message "$SOURCE_COMMIT" | |
git push | |
popd &>/dev/null |