Skip to content

Instantly share code, notes, and snippets.

@CypherpunkSamurai
Created March 16, 2022 19:15
Show Gist options
  • Select an option

  • Save CypherpunkSamurai/85f6214d579a6fa61bc66a4a45c3c3ec to your computer and use it in GitHub Desktop.

Select an option

Save CypherpunkSamurai/85f6214d579a6fa61bc66a4a45c3c3ec to your computer and use it in GitHub Desktop.
Github Actions CI
name: Github Pages
on:
push:
branches:
- master # Here source code branch is `master`, it could be other branch
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: πŸ—³ Checkout Repo
uses: actions/checkout@v2
# Use GitHub Actions' cache to cache dependencies on servers
- name: πŸ“¦ Cache Dependencies
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
# Use GitHub Actions' cache to cache dependencies on servers
- name: πŸ“₯ Install ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 3.0
- name: πŸ“ Jekyll publish
env:
JEKYLL_DESTINATION: gh-pages
run: |
#sudo apt-get -yqq install libpq-dev
#gem install bundle
bundle install --path=vendor/bundle --jobs 4
bundle clean
JEKYLL_ENV=production bundle exec jekyll build --destination $JEKYLL_DESTINATION
- name: πŸ“€ Push to Repo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
JEKYLL_DESTINATION: gh-pages
run: |
git config --global user.name "Github Actions"
git config --global user.email "test@github.com"
git add "$JEKYLL_DESTINATION" && git commit -m "Github Pages Publish"
git subtree split --prefix "$JEKYLL_DESTINATION" -b gh-pages
git push -f origin gh-pages:gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment