Merge pull request #299 from saito400/update #196
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: Test & Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
# Allows you to run this workflow manually from the Actions tab | |
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ☑️ Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: 💎 Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: 🧪 Install gems | |
run: | | |
cd ./docs | |
bundle install | |
- name: 🔧 Build & Test | |
run: | | |
cd ./docs | |
JEKYLL_ENV=production bundle exec jekyll build | |
bundle exec rake upsert_data_by_readme | |
bundle exec rake test | |
- name: 🚀 Deploy | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: | | |
cd ./docs | |
if [ -n "$(git status en ja --porcelain)" ]; then | |
git config --global user.name "Yohei Yasukawa" | |
git config --global user.email "[email protected]" | |
git checkout main | |
git add en ja | |
git commit -m '🤖 Generate page(s) by README' | |
git push origin main | |
fi |