Merge pull request #42 from govlt/residential-areas-min-zoom #126
Workflow file for this run
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: Publish PMTiles | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
workflow_dispatch: | |
permissions: { } | |
jobs: | |
generate-geopackage: | |
name: Generate GeoPackage | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
container: ghcr.io/osgeo/gdal:ubuntu-full-3.9.1 | |
permissions: | |
contents: read | |
steps: | |
- name: Install csvkit | |
run: apt-get update && apt-get install -y csvkit | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create GeoPackage | |
run: chmod +x create-geopackage.sh && ./create-geopackage.sh | |
- name: Upload GeoPackage artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: boundaries-4326.gpkg | |
path: boundaries-4326.gpkg | |
if-no-files-found: error | |
- name: Upload checksums artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data-source-checksums.txt | |
path: data-sources/data-source-checksums.txt | |
if-no-files-found: error | |
generate-pmtiles: | |
name: Generate PMTiles | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: | |
- generate-geopackage | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Download municipalities artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: boundaries-4326.gpkg | |
path: data | |
merge-multiple: true | |
- name: Generate vector basemap PMTiles | |
shell: bash | |
run: ./gradlew -q run | tee logs-planetiler.txt | |
- name: Upload PMTiles artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pmtiles | |
path: data/output | |
if-no-files-found: error | |
compression-level: 0 | |
- name: Upload PlaneTiler generate logs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs-planetiler | |
path: logs-planetiler.txt | |
if-no-files-found: error | |
publish-release: | |
name: Publish release | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
concurrency: publish-release | |
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }} | |
needs: | |
- generate-geopackage | |
- generate-pmtiles | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download PMTiles artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pmtiles | |
path: pmtiles | |
merge-multiple: true | |
- name: Download boundaries artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: boundaries-4326.gpkg | |
path: . | |
merge-multiple: true | |
- name: Download checksums artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: data-source-checksums.txt | |
path: . | |
merge-multiple: true | |
- name: Get next version | |
uses: reecetech/[email protected] | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
id: version | |
with: | |
scheme: calver | |
- name: Upload artifacts to GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
make_latest: true | |
generate_release_notes: ${{ startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }} | |
append_body: true | |
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && '' || steps.version.outputs.version }} | |
files: | | |
boundaries-4326.gpkg | |
pmtiles/counties.pmtiles | |
pmtiles/municipalities.pmtiles | |
pmtiles/elderships.pmtiles | |
pmtiles/residential-areas.pmtiles | |
pmtiles/streets.pmtiles | |
pmtiles/parcels.pmtiles | |
data-source-checksums.txt | |
publish-boundaries-vector-docker-image: | |
name: Vector docker image build and push | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
needs: | |
- generate-geopackage | |
- generate-pmtiles | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pmtiles | |
path: vector/docker/static/tiles | |
merge-multiple: true | |
- name: Build & tag docker image | |
uses: AplinkosMinisterija/reusable-workflows/.github/actions/docker-build-tag-push@main | |
with: | |
docker-image: ghcr.io/govlt/national-boundaries-vector | |
docker-context: vector/docker/static | |
file: vector/docker/static/Dockerfile | |
environment: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && 'stable' || 'preview' }} | |
no-cache: true | |
push: true | |
cache-from: '' | |
cache-to: '' | |
publish-page: | |
name: Publish page | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: | |
- generate-geopackage | |
- generate-pmtiles | |
permissions: | |
contents: read | |
deployments: write | |
steps: | |
- name: Download PMTiles artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pmtiles | |
path: output/pmtiles | |
merge-multiple: true | |
# Cloudflare Pages only supports files up to 25 MiB in size | |
# Temporary delete these file | |
- name: Delete files over 25 MiB | |
run: rm output/pmtiles/residential-areas.pmtiles output/pmtiles/parcels.pmtiles | |
- name: Upload to Cloudflare pages | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT_ID }} | |
command: pages deploy output --project-name=national-boundaries --commit-dirty=true | |
- name: Upload page artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: page | |
path: . |