Skip to content

fix generate_database action #109

fix generate_database action

fix generate_database action #109

Workflow file for this run

# This workflow will install Python dependencies,
# run the python script to generate the database,
# and upload the regenerated database to the binary repo
name: Generate Database
on:
# More details on trigger events:
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows
pull_request: # added for testing
workflow_dispatch: # manual execution
release:
types: [published]
branches: [main]
jobs:
build:
# Only run for the SIMPLE-AstroDB/SIMPLE-db repo, not on any forks
if: github.repository == 'SIMPLE-AstroDB/SIMPLE-db'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install astrodbkit2
pip install git+https://github.com/astrodbtoolkit/astrodb_scripts.git@main
- name: Generate sqlite (file) database
run: |
python simple/utils/generate_database.py sqlite
working-directory: .
# The postgres database creation can take a while on the hobby-dev tier in Heroku
# Disabling until we have a better idea on how to use this
# - name: Generate postgres (Heroku) database
# env:
# SIMPLE_DATABASE_URL: ${{secrets.SIMPLE_DATABASE_URL}}
# run: |
# pip install psycopg2
# python scripts/tutorials/generate_database.py postgres
# working-directory: .
- name: Push database file
uses: dmnemec/copy_file_to_another_repo_action@main
# Details for this action at https://github.com/marketplace/actions/push-a-file-to-another-repository
env:
API_TOKEN_GITHUB: ${{ secrets.SIMPLE_TOKEN }}
with:
source_file: 'SIMPLE.sqlite'
destination_repo: 'SIMPLE-AstroDB/SIMPLE-binary'
destination_branch: 'main'
user_email: '[email protected]'
user_name: 'github-actions'