Last active
September 2, 2022 03:11
-
-
Save joshlarsen/4e7851e91ef4a7db8dfa89c2f993bb23 to your computer and use it in GitHub Desktop.
Basic Jekyll Deploy Action
This file contains hidden or 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
#!/bin/bash | |
set -e | |
DEST="${JEKYLL_DESTINATION:-_site}" | |
REPO="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
BRANCH="gh-pages" | |
BUNDLE_BUILD__SASSC=--disable-march-tune-native | |
echo "Installing gems..." | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
echo "Building Jekyll site..." | |
JEKYLL_ENV=production NODE_ENV=production bundle exec jekyll build | |
echo "Publishing..." | |
cd ${DEST} | |
git init | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add . | |
git commit -m "published by GitHub Actions" | |
git push --force ${REPO} master:${BRANCH} |
This file contains hidden or 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 Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: GitHub Checkout | |
uses: actions/checkout@v2 | |
- name: Install JavaScript Packages | |
run: yarn | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Build & Deploy to GitHub Pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: deploy.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment