smnorris production #15
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: production | |
run-name: ${{ github.actor }} production | |
on: | |
schedule: | |
- cron: '0 21 * * FRI' | |
workflow_dispatch: | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
jobs: | |
bcfishobs: | |
runs-on: ubuntu-latest | |
environment: production | |
container: ghcr.io/smnorris/bcfishpass:main | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Run bcfishobs | |
run: | | |
mkdir -p .make | |
make -t .make/setup | |
make -t .make/load_static | |
make -t .make/fiss_fish_obsrvtn_pnt_sp | |
make --debug=basic | |
psql $DATABASE_URL -c "select * from bcfishobs.summary" | |
- name: Dump to file | |
run: | | |
ogr2ogr \ | |
-f GPKG \ | |
bcfishobs.gpkg \ | |
PG:$DATABASE_URL \ | |
-nln fiss_fish_obsrvtn_events_vw \ | |
-sql "select fish_observation_point_id, | |
fish_obsrvtn_event_id, | |
linear_feature_id, | |
wscode_ltree as wscode, | |
localcode_ltree as localcode, | |
blue_line_key, | |
waterbody_key, | |
downstream_route_measure, | |
distance_to_stream, | |
match_type, | |
watershed_group_code, | |
species_id, | |
species_code, | |
agency_id, | |
observation_date, | |
agency_name, | |
source, | |
source_ref, | |
activity_code, | |
activity, | |
life_stage_code, | |
life_stage, | |
acat_report_url, | |
geom from bcfishobs.fiss_fish_obsrvtn_events_vw" | |
ogr2ogr \ | |
-f GPKG \ | |
-append \ | |
-update \ | |
bcfishobs.gpkg \ | |
PG:$DATABASE_URL \ | |
-nln fiss_fish_obsrvtn_unmatched \ | |
-sql "select * from bcfishobs.fiss_fish_obsrvtn_unmatched" | |
ogr2ogr \ | |
-f GPKG \ | |
-append \ | |
-update \ | |
bcfishobs.gpkg \ | |
PG:$DATABASE_URL \ | |
-nln summary \ | |
-sql "select * from bcfishobs.summary" | |
sozip bcfishobs.gpkg.zip bcfishobs.gpkg | |
aws s3 cp bcfishobs.gpkg.zip s3://bcfishpass/bcfishobs.gpkg.zip |