sentrylab build sync and reload. #1144
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: sentrylab build sync and reload. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: '0 15 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
LSI: 'true' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- name: cache Ruby Bundler | |
id: cache | |
uses: actions/cache@v2 | |
env: | |
CACHE_ID: 1 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-bundler-${{ env.CACHE_ID }}-${{ hashFiles('Gemfile') }} | |
restore-keys: | | |
${{ runner.os }}-bundler-${{ env.CACHE_ID }}- | |
- name: Change rubygems loading | |
run: sed -i "/^source/c source 'https://rubygems.org'" Gemfile | |
- name: install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: bundle install --path=vendor/bundle --jobs=4 --retry=3 | |
- name: setup commit hash string | |
run: | | |
commitString=$(git rev-list HEAD --abbrev-commit --max-count=1) | |
echo "commitString: $commitString" >> _config.yml | |
- name: run jekyll-build | |
run: | | |
bundle config set --local path 'vendor/bundle' | |
bundle exec jekyll build --trace | |
- name: simple deploy with git | |
uses: rdarida/simple-github-pages-deploy-action@v1 | |
with: # optional | |
git-user: ${{ secrets.Git_USERNAME }} | |
git-email: ${{ secrets.Git_EMAIL }} | |
git-base-folder: '_site' | |
commit-message: '<auto generate>:🚀page build/deploy by github action.' | |
branch: 'gh-pages' | |
auto_commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check for changes | |
id: check_changes | |
run: | | |
/bin/bash scripts/snippets.sh | |
# git diff --exit-code && echo "Files are unchanged" || echo "Files have changed" | |
- name: Commit changes | |
# if: steps.check_changes.outputs.stdout == 'Files have changed' | |
run: | | |
if git diff --exit-code; then exit 0; else git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add README.md | |
git commit -m "<Actions>:🚀 Push file while $web_version changed" | |
git push; fi |