Deploy #20
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: Deploy | |
on: [ workflow_dispatch ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/cache@v2 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
- name: Install dependencies | |
run: | | |
git submodule update --init | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Generate guides files | |
run: bundle exec rake guides:generate:html | |
- name: Git setup | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git stash --include-untracked | |
git checkout --track origin/site | |
- name: Commit site changes | |
run: | | |
rm site/javascripts/lunr-documents.js | |
rm site/javascripts/lunr-index.js | |
git stash apply | |
cp $(find output/pt-BR -name "*.html") site | |
git add site/ | |
git commit -m "Build from commit ${GITHUB_SHA}" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
branch: 'site' |