Skip to content

Commit

Permalink
Merge pull request #36 from govlt/chekc-for-data-source-updates
Browse files Browse the repository at this point in the history
Check for data source updates
  • Loading branch information
vycius authored Jul 30, 2024
2 parents 3a2acff + 6943aa5 commit d9b3939
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 2 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/check-for-updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Check for data source updates

on:
workflow_dispatch:
push:
schedule:
- cron: "0 13 * * *"

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: Checkout repository
uses: actions/checkout@v4

- name: Crete GeoPackage
run: chmod +x create-geopackage.sh && ./create-geopackage.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 GeoPackage artifact
uses: actions/upload-artifact@v4
with:
name: boundaries-4326.gpkg
path: boundaries-4326.gpkg
if-no-files-found: error

- name: Debug
run: echo "Hello debug" >> data-sources/data-source-checksums.txt

- name: Download latest data source hashes
run: wget -O published-data-source-checksums.txt "https://github.com/govlt/national-boundaries/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 != '' }}
runs-on: ubuntu-latest
concurrency: check-for-data-source-updates-create-release
needs:
- check-for-updates
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Token for creating new Release
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
permissions: "contents:write"
revoke_token: true

- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: calver

- name: Release
uses: softprops/action-gh-release@v2
with:
make_latest: false
tag_name: ${{ steps.version.outputs.version }}
token: ${{ steps.get_workflow_token.outputs.token }}
body: |
Automated release after data source update
```
${{ needs.check-for-updates.outputs.diff }}
```
8 changes: 6 additions & 2 deletions .github/workflows/publish-pmtiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
workflow_dispatch:

Expand All @@ -21,7 +23,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Generate
- name: Crete GeoPackage
run: chmod +x create-geopackage.sh && ./create-geopackage.sh

- name: Upload GeoPackage artifact
Expand Down Expand Up @@ -122,6 +124,7 @@ jobs:

- name: Get next version
uses: reecetech/[email protected]
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
id: version
with:
scheme: calver
Expand All @@ -131,7 +134,8 @@ jobs:
with:
make_latest: true
generate_release_notes: true
tag_name: ${{ steps.version.outputs.version }}
append_body: true
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref || steps.version.outputs.version }}
files: |
boundaries-4326.gpkg
pmtiles/counties.pmtiles
Expand Down

0 comments on commit d9b3939

Please sign in to comment.