-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from govlt/chekc-for-data-source-updates
Check for data source updates
- Loading branch information
Showing
2 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
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
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 }} | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
|
@@ -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 | ||
|
@@ -122,6 +124,7 @@ jobs: | |
|
||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
id: version | ||
with: | ||
scheme: calver | ||
|
@@ -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 | ||
|