Update Site #526
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 Site | |
run-name: Update Site | |
on: | |
schedule: | |
# - cron: '*/15 * * * *' # Run every 15 minutes | |
- cron: '0 1 * * *' # this means the action will run daily at midnight | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run script | |
run: python main.py | |
- name: Configure git | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Commit changes | |
run: | | |
git add . | |
git commit -m "Site update" | |
- name: Pull latest changes | |
run: | | |
git pull origin main --rebase | |
- name: Push changes | |
run: | | |
git push -f origin main |