Build USCIS DB #812
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@v3 | |
- name: Download previous DB | |
uses: robinraju/[email protected] | |
with: | |
latest: true | |
fileName: '*.db' | |
out-file-path: 'prev' | |
- name: Build DB and changelog | |
run: OPENSSL_CONF=openssl.cnf ./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: Upload changelog | |
uses: actions/upload-artifact@v3 | |
with: | |
name: changelog | |
path: | | |
changelog.txt | |
sqldiff.txt | |
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 }} | |
body_path: 'changelog/changelog.txt' | |
files: 'uscis-db/*.db' | |
fail_on_unmatched_files: true |