Update recent blog posts and deploy #484
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: Update recent blog posts and deploy | |
on: | |
schedule: | |
- cron: "0 21 * * *" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Generate recent updates | |
run: node generateRecentUpdates.js | |
- name: Commit updates (+ trigger Vercel deploy) | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add . | |
# Check if there are any changes to commit | |
if git diff --staged --quiet; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update recent posts" | |
git push | |
fi |