Deploy Jekyll with GitHub Pages #619
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: Publish to GitHub Pages | |
on: | |
push: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
jekyll: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- uses: helaili/jekyll-action@2.5.0 | |
with: | |
target_branch: gh-pages | |
keep_history: true | |
build_only: true | |
jekyll_build_options: -d /github/workspace/jekyll_build | |
- name: Deploy | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git clone --branch gh-pages https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git && cd smooks.github.io | |
git rm -rf . && git checkout HEAD -- v1.7/ | |
cp -r ../jekyll_build/* . | |
touch .nojekyll | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit --allow-empty -m "jekyll build from Action ${GITHUB_SHA}" | |
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git gh-pages:gh-pages |