Data Backup #19
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: Data Backup | |
on: | |
schedule: | |
- cron: '30 17 */2 * *' # Run every days at 11:00 PM IST every 2 days | |
jobs: | |
backup_db_data: | |
runs-on: ubuntu-latest | |
env: | |
PG_DATABASE_URL: ${{ secrets.PG_DATABASE_URL }} | |
BACKUP_ENCRYPTION_KEY: ${{ secrets.BACKUP_ENCRYPTION_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
run_install: true | |
- name: Setup PostgreSQL | |
uses: tj-actions/install-postgresql@v3 | |
with: | |
postgresql-version: 16 | |
- name: Load Translations and DB Dump | |
run: | | |
cd src/db/scripts/ | |
npx tsx backup_db_data.ts | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: db_backup | |
path: src/db/scripts/backup/ | |
retention-days: 60 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
# set working directory to data/ramayan | |
# Install dependencies | |
- name: Install dependencies | |
working-directory: data/ramayan | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Generate Excel Files | |
working-directory: data/ramayan | |
run: | | |
python3 get_json.py --no-run-test | |
- run: | | |
npx vite-node data/ramayan/make_excel_files.ts --no-zip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: excel_files | |
path: data/ramayan/out/ | |
retention-days: 60 |