Skip to content

Collect Orbit Data

Collect Orbit Data #59

Workflow file for this run

name: Collect Orbit Data
on:
# Runs every week at 03:00
schedule:
- cron: "0 3 * * */6"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to run this workflow manually from another workflow
workflow_call:
inputs:
collect:
default: true
required: false
type: boolean
upload:
default: true
required: false
type: boolean
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: ${{ (inputs.upload == true || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && 'pages' || 'test'}}
cancel-in-progress: true
jobs:
collect:
runs-on: ubuntu-latest
if: ${{ inputs.collect == true || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Restore Cache
uses: actions/cache/restore@v3
with:
path: ./data
key: data-${{ hashFiles('./collector/*.py') }}
restore-keys: data-${{ hashFiles('./collector/*.py') }}
- name: Get a random number
run: echo "RANDOM_SUFFIX=${RANDOM}${RANDOM}" >> $GITHUB_ENV
- name: Setup Cache
uses: actions/cache@v3
with:
path: ./data
key: data-${{ hashFiles('./collector/*.py') }}-${{ env.RANDOM_SUFFIX }}
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Generate the orbits file
working-directory: ./collector
run: |
poetry env use "3.10"
poetry install --no-interaction
poetry run python main.py --update-db --cache-path ../data
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: orbits-latest
path: ./data
retention-days: 1
upload:
runs-on: ubuntu-latest
needs: collect
if: |
always() &&
(inputs.upload == true || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') &&
(needs.collect.result == 'success' || needs.collect.result == 'skipped')
steps:
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: orbits-latest
path: ./data
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./data
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1