-
Notifications
You must be signed in to change notification settings - Fork 22
62 lines (52 loc) · 1.99 KB
/
gen-db.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 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 scripts/tutorials/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'