Create jekyll-docker.yml #2
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: Jekyll site CI | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: source | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
path: build | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.3' | ||
- uses: actions/cache@v4 | ||
with: | ||
path: source/vendor/bundle | ||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gems- | ||
- name: Bundle install | ||
working-directory: source | ||
run: | | ||
gem install bundler --no-document | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
- name: Jekyll Build | ||
working-directory: source | ||
run: JEKYLL_ENV=production bundle exec jekyll build -d ../build | ||
- name: Commit and push changes to main | ||
working-directory: build | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git add . | ||
git commit -m "Update GitHub pages from Jekyll build for commit ${GITHUB_SHA}" | ||
git push origin main |