Skip to content

Commit 930301a

Browse files
committed
Add scheduler_daily.yml to Actions
1 parent 0f3bfca commit 930301a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/scheduler_daily.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Daily Update
2+
3+
# NOTE: GitHub Action's scheduler is always set to UTC+0. So 9am should be set at 0am for JST (UTC+9)
4+
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule
5+
6+
# '0 23 * * *' == 8am in JST (UTC+9)
7+
# '0 0 * * *' == 9am in JST (UTC+9)
8+
# '0 1 * * *' == 10am in JST (UTC+9)
9+
# '59 23 * * *' task will be completed after 9am in JST
10+
on:
11+
schedule:
12+
- cron: '59 20 * * *'
13+
14+
# [DEBUG ONLY] Every 5 minutes
15+
# https://github.blog/changelog/2019-11-01-github-actions-scheduled-jobs-maximum-frequency-is-changing
16+
#- cron: '*/5 * * * *'
17+
18+
# Allows you to run this workflow manually from the Actions tab
19+
workflow_dispatch:
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: 📥 Download codes from GitHub
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 2
30+
31+
- name: 💎 Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
#with:
34+
# bundler-cache: true
35+
#ruby-version: 3.2 # Not necessary if .ruby-version is given
36+
37+
- name: 🧪 Install Ruby gems
38+
run: |
39+
bundle install
40+
41+
- name: 📊 Update dojo stats of Japan
42+
run: |
43+
bundle exec ruby update_profile.rb
44+
45+
- name: 🆙 Update profile if updated
46+
run: |
47+
if [ -n "$(git status --porcelain)" ]; then
48+
git config --global user.name "Yohei Yasukawa"
49+
git config --global user.email "[email protected]"
50+
git checkout main
51+
git add _data/stats.yml
52+
git commit -m '🤖 Update dojo stats'
53+
git push origin main
54+
fi
55+
env:
56+
GITHUB_TOKEN:
57+
58+
- name: 🔧 Build & Test
59+
run: |
60+
JEKYLL_ENV=production bundle exec jekyll build
61+
JEKYLL_ENV=production bundle exec jekyll doctor
62+
SKIP_BUILD=true bundle exec rake test
63+
64+
- name: 🚀 Deploy to GitHub Pages
65+
if: github.ref == 'refs/heads/main' && job.status == 'success'
66+
uses: peaceiris/actions-gh-pages@v3
67+
with:
68+
personal_token: ${{ secrets.GITHUB_TOKEN }}
69+
publish_dir: ./_site

0 commit comments

Comments
 (0)