Rebuild and Deploy #190
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: Rebuild and Deploy | |
on: | |
schedule: | |
# At 18:30 UTC on Sunday (12:00 midnight in Sri Lanka) | |
#- cron: "30 18 * * 0" | |
# At minute 0 past every two hours | |
# - cron: "0 */2 * * *" | |
# At minute 0 past every 1 hour | |
# - cron: "0 * * * *" | |
# At 18:30 UTC every day (12:00 midnight in Sri Lanka) | |
- cron: "30 18 * * *" | |
# Enables a button on Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests tqdm | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run the Python script | |
run: python rebuild_deploy.py | |
- name: Commit and push changes | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "Site build using GitHub Actions" || echo "No changes to commit" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |