File tree Expand file tree Collapse file tree 2 files changed +64
-39
lines changed Expand file tree Collapse file tree 2 files changed +64
-39
lines changed Original file line number Diff line number Diff line change 1+ name : Daily Workflow
2+
3+ on :
4+ schedule :
5+ # 毎朝 9:00 JST
6+ - cron : ' 0 0 * * *'
7+ # Allows you to run this workflow manually from the Actions tab
8+ # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
9+ workflow_dispatch :
10+
11+ jobs :
12+ daily :
13+ runs-on : ubuntu-latest
14+ outputs :
15+ FOUND_NEWS : ${{ steps.check_news.outputs.FOUND_NEWS }}
16+
17+ steps :
18+ - name : ☑️ Checkout code
19+ uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 2
22+
23+ - name : 💎 Setup Ruby
24+ uses : ruby/setup-ruby@v1
25+ with :
26+ bundler-cache : true
27+
28+ - name : 📰 Run news:fetch task
29+ run : bin/rails news:fetch
30+
31+ - name : 🆙 Commit updated news.yml
32+ id : check_news
33+ run : |
34+ git config user.name "Yohei Yasukawa"
35+ git config user.email "[email protected] " 36+ git checkout main
37+ git add db/news.yml
38+ if ! git diff --cached --quiet; then
39+ git commit -m '🤖 Upsert db/news.yml'
40+ git push origin main
41+ echo "🆕 Found news in db/news.yml"
42+ echo "FOUND_NEWS=true" >> $GITHUB_OUTPUT
43+ else
44+ echo "✅ No news in db/news.yml"
45+ echo "FOUND_NEWS=false" >> $GITHUB_OUTPUT
46+ fi
47+
48+ deploy :
49+ needs : daily
50+ if : ${{ needs.daily.outputs.FOUND_NEWS == 'true' }}
51+ runs-on : ubuntu-latest
52+
53+ steps :
54+ - name : ☑️ Checkout code
55+ uses : actions/checkout@v4
56+ with :
57+ ref : main
58+
59+ - name : 🚀 Deploy to Heroku
60+ uses :
akhileshns/[email protected] 61+ with :
62+ heroku_api_key : ${{ secrets.HEROKU_API_KEY }}
63+ heroku_app_name : ${{ secrets.HEROKU_APP_NAME }}
64+ heroku_email : ${{ secrets.HEROKU_EMAIL }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments