Update CNAME: dojocon2024 -> dojocon2025-test #23
This file contains hidden or 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: | |
- "*" | |
jobs: | |
# Test job is always triggered as continuous integration | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ☑️ Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: 💎 Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: false | |
- name: 🧪 Install gems | |
run: | | |
bundle config set with 'test' | |
bundle config set path 'vendor/bundle' | |
bundle install --jobs 4 --retry 3 | |
- name: 🔧 Build & Test | |
run: | | |
JEKYLL_ENV=production bundle exec jekyll build | |
JEKYLL_ENV=production bundle exec jekyll doctor | |
# SKIP_BUILD=true bundle exec rake test | |
# NOTE: サイトが仕上がったら、上記テストを走らせると自動検知できる。 | |
# ただ初期は自動検知の通知が多すぎるので手動で実行するのが吉。 | |
# Deploy job is triggered only pushed to main branch && CI passed | |
deploy: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: ☑️ Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: 💎 Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: false | |
- name: 🧪 Install gems | |
run: | | |
bundle config set with 'test' | |
bundle config set path 'vendor/bundle' | |
bundle install --jobs 4 --retry 3 | |
- name: 🔧 Build | |
run: | | |
JEKYLL_ENV=production bundle exec jekyll build | |
#- name: 🤖 Generate individual pages by projects.yml data | |
# run: | | |
# bundle exec rake upsert_project_pages_by_data | |
# if [ -n "$(git status ./_pages --porcelain)" ]; then | |
# if ( ruby -ryaml -e "p YAML.unsafe_load(STDIN.read)" < _data/projects.yml > /dev/null ); then | |
# # デフォルトでは内情に詳しい @yasulab としていますが、適宜ユーザー名を変えてください。 | |
# git config --global user.name "yasulab" | |
# git config --global user.email "yohei@yasslab.jp" | |
# git checkout main | |
# git add _pages/exhibition | |
# git add Gemfile.lock | |
# git commit -m '🤖 Upsert project page(s) by GitHub Actions' | |
# git push origin main | |
# else | |
# echo "Detect syntax error in '_data/projects.yml' file, check its syntax." | |
# fi | |
# fi | |
- name: 🚀 Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' && job.status == 'success' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site | |