Skip to content

Check for data source updates #55

Check for data source updates

Check for data source updates #55

name: Check for data source updates
on:
workflow_dispatch:
schedule:
- cron: "0 14 * * *"
jobs:
check-for-updates:
name: Check for updates
runs-on: ubuntu-latest
container: ghcr.io/osgeo/gdal:ubuntu-full-3.9.1
concurrency: check-for-data-source-updates
timeout-minutes: 30
permissions:
contents: read
outputs:
diff: ${{ steps.comparison.outputs.diff }}
steps:
- name: Install csvkit
run: apt-get update && apt-get install -y csvkit
- name: Checkout code
uses: actions/checkout@v4
- name: Create database
run: chmod +x create-database.sh && ./create-database.sh
- name: Upload data-source-checksums.txt artifact
uses: actions/upload-artifact@v4
with:
name: data-source-checksums.txt
path: data-sources/data-source-checksums.txt
if-no-files-found: error
- name: Upload boundaries.sqlite artifact
uses: actions/upload-artifact@v4
with:
name: boundaries.sqlite
path: boundaries.sqlite
if-no-files-found: error
- name: Download latest data source hashes
run: wget -O published-data-source-checksums.txt "https://github.com/govlt/national-boundaries-api/releases/latest/download/data-source-checksums.txt"
- name: Upload published-data-source-checksums.txt artifact
uses: actions/upload-artifact@v4
with:
name: published-data-source-checksums.txt
path: published-data-source-checksums.txt
if-no-files-found: error
- name: Check that the files are the exact same
id: comparison
run: |
{
echo 'diff<<EOF'
(diff -u 'published-data-source-checksums.txt' 'data-sources/data-source-checksums.txt' || :)
echo 'EOF'
} >> "${GITHUB_OUTPUT}"
create-release:
name: Create release
if: ${{ needs.check-for-updates.outputs.diff != '' }}
concurrency: check-for-data-source-updates-create-release
needs:
- check-for-updates
permissions:
contents: read
uses: ./.github/workflows/reusable-workflow-create-release.yml
with:
increment: patch
generate_release_notes: false
body: |
Automated release after data source update
```
${{ needs.check-for-updates.outputs.diff }}
```
secrets:
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
APPLICATION_PRIVATE_KEY: ${{ secrets.APPLICATION_PRIVATE_KEY }}