gh-pages deploy #1007
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: gh-pages deploy | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 18 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.2 | |
- name: Install node dependencies | |
run: | | |
npm install -g yarn | |
yarn install | |
- name: Set up Ruby 2.7 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7.4 | |
bundler-cache: true | |
- name: Install ruby dependencies | |
run: | | |
gem install bundler -v 2.3.13 | |
bundle install | |
- name: Initialize & update hub submodule | |
run: | | |
git submodule deinit -f . && git submodule update --init --recursive | |
git submodule update --remote | |
./_devel/update_hub_submodule.sh | |
- name: Build Jekyll site | |
env: | |
JEKYLL_GITHUB_TOKEN: ${{ secrets.JEKYLL_GITHUB_TOKEN }} | |
run: | | |
make build_deploy | |
- name: Deploy Jekyll site | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "reserve.dev@gmail.com" | |
export remote_repo="https://x-access-token:${{ secrets.DEPLOY_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
export remote_branch="gh-pages" | |
cd _site/ | |
git init | |
git add . | |
git commit -m "Rebuild" | |
git push --force $remote_repo master:$remote_branch > /dev/null 2>&1 | |
echo "Done" |