Build USCIS DB #514
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: Build USCIS DB | |
on: | |
schedule: | |
- cron: '30 4 * * *' | |
workflow_dispatch: | |
jobs: | |
build_db: | |
runs-on: ubuntu-latest | |
outputs: | |
dbname: ${{ steps.dbname.outputs.dbname }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build DB | |
run: ./build_db.sh | |
- name: Get DB name | |
id: dbname | |
run: echo ::set-output name=dbname::"$(basename *.db .db)" | |
- name: Upload DB | |
uses: actions/upload-artifact@v3 | |
with: | |
name: uscis-db | |
path: '${{ steps.dbname.outputs.dbname }}.db' | |
if-no-files-found: error | |
- name: Build JSON DB | |
if: always() | |
run: sqlite3 responses.db -A -c *.json | |
- name: Upload JSON DB | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: responses-db | |
path: 'responses.db' | |
if-no-files-found: error | |
publish_db: | |
runs-on: ubuntu-latest | |
needs: build_db | |
steps: | |
- name: Download DB | |
uses: actions/download-artifact@v3 | |
- name: Create daily release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ needs.build_db.outputs.dbname }} | |
tag_name: ${{ needs.build_db.outputs.dbname }} | |
files: 'uscis-db/*.db' | |
fail_on_unmatched_files: true |