Skip to content

updated flow to see if public folder is presnet #14

updated flow to see if public folder is presnet

updated flow to see if public folder is presnet #14

Workflow file for this run

name: Scheduled Fetch and Build on Push
on:
push:
branches:
- main # Adjust if you want to run on a different branch
schedule:
# Runs at 10:00 PM IST every day, actions run on UTC
- cron: '30 16 * * *'
workflow_dispatch: # Enables manual triggering
jobs:
fetch-and-build:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run fetch.py
run: python scripts/fetch.py
- name: Temporarily allow public directory
run: |
sed -i '/public\//d' .gitignore
- name: Commit and Push Changes
run: |
git config --global user.name "DailyUpdateBot"
git config --global user.email "bot@npsnav.in"
git add .
git commit -m "Daily NAV update by bot" || echo "Nothing to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Revert .gitignore changes (optional)
run: |
echo 'public/' >> .gitignore
git add .gitignore
git commit -m "Revert .gitignore change" || echo "No .gitignore change to revert"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-on-push:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run build.py
run: python scripts/build.py
- name: Temporarily allow public directory
run: |
sed -i '/public\//d' .gitignore
- name: Commit and Push Changes
run: |
git config --global user.name "BuildBot"
git config --global user.email "bot@npsnav.in"
git add .
git commit -m "Build triggered by push" || echo "Nothing to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Revert .gitignore changes (optional)
run: |
echo 'public/' >> .gitignore
git add .gitignore
git commit -m "Revert .gitignore change" || echo "No .gitignore change to revert"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}