Skip to content

Auto Post from Naver Blog #278

Auto Post from Naver Blog

Auto Post from Naver Blog #278

Workflow file for this run

name: Auto Post from Naver Blog
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up Chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- name: Install Python dependencies
run: |
pip install feedparser html2text python-dotenv requests beautifulsoup4 selenium webdriver-manager
- name: Run auto_post.py
env:
NAVER_RSS_URL: ${{ secrets.NAVER_RSS_URL }}
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
run: python auto_post.py
- name: Sync posts into master
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
run: |
set -e
git fetch origin master
git checkout master
git config user.name "${GIT_USER_NAME}"
git config user.email "${GIT_USER_EMAIL}"
# auto-post 브랜치가 있을 때만 sync
if git rev-parse --verify origin/auto-post >/dev/null 2>&1; then
git checkout auto-post -- public/posts public/images/posts public/sitemap.xml
git add public/posts public/images/posts public/sitemap.xml
git diff --staged --quiet && exit 0
git commit -m "Sync posts from auto-post $(date '+%Y-%m-%d %H:%M:%S')"
git push origin master
else
echo "No auto-post branch found, skipping sync"
fi
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install npm dependencies
run: npm install
- name: Build and Deploy
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy -- -u "github-actions-bot <support+actions@github.com>"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REACT_APP_FIREBASE_API_KEY: ${{ secrets.REACT_APP_FIREBASE_API_KEY }}
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}