sentrylab build sync and reload. #909
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: | |
workflow_dispatch: | |
inputs: | |
note: | |
description: "Test scenario tags" | |
required: false | |
default: "Let's go." | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: '0 15 * * *' | |
env: | |
github-Access: "https://github.com/Bin4xin" | |
github-ReposAccess: "bin4xin.github.io" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
LSI: 'true' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Clone and copy files | |
run: | | |
git clone ${{ env.github-Access }}/${{ env.github-ReposAccess }} | |
cd ${{ env.github-ReposAccess }} | |
cp -R ../_posts/* _posts/ | |
echo "sentrylab.cn" > CNAME | |
commitString=$(git rev-list HEAD --abbrev-commit --max-count=1) | |
echo "commitString: $commitString" >> _config.yml | |
sed -i "/^source/c source 'https://rubygems.org'" Gemfile | |
- 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: 2 | |
with: | |
path: /tmp/bundle | |
key: ${{ runner.os }}-bundler-${{ env.CACHE_ID }}-${{ hashFiles('${{ env.github-ReposAccess }}/Gemfile') }} | |
restore-keys: | | |
${{ runner.os }}-bundler-${{ env.CACHE_ID }}- | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: cd ${{ env.github-ReposAccess }} && bundle install --path=/tmp/bundle --jobs=4 --retry=3 | |
- name: Run jekyll-build | |
run: cd ${{ env.github-ReposAccess }} && bundle config set --local path '/tmp/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: '${{ env.github-ReposAccess }}/_site' | |
commit-message: '🚀page build/deploy by github action🤖' | |
branch: 'gh-pages' |