Build & deploy vector tiles #436
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 & deploy vector tiles" | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
REGION: africa | |
AREA: rwanda | |
TILEMAKER_IMAGE: ghcr.io/jinigarashi/tilemaker:master | |
PMTILES_IMAGE: ghcr.io/protomaps/go-pmtiles:main | |
jobs: | |
tilemaker-build: | |
name: Generate vector tiles by tilemaker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download PBF file | |
run: | | |
mkdir data | |
curl -L http://download.geofabrik.de/${{ env.REGION }}/${{ env.AREA }}-latest.osm.pbf -o ./data/${{ env.AREA }}.osm.pbf | |
- name: pull docker image | |
run: | | |
docker pull ${{ env.TILEMAKER_IMAGE }} | |
docker pull ${{ env.PMTILES_IMAGE }} | |
- name: Build openmaptiles-compatible mbtiles files of given area | |
run: docker run -v $(pwd)/data:/srv ${{ env.TILEMAKER_IMAGE }} --input=/srv/${{ env.AREA }}.osm.pbf --output=/srv/${{ env.AREA }}.mbtiles | |
- name: Convert mbtiles to pmtiles | |
run: | | |
docker run -v $(pwd)/data:/srv ${{ env.PMTILES_IMAGE }} convert /srv/${{ env.AREA }}.mbtiles /srv/${{ env.AREA }}.pmtiles --tmpdir=/srv | |
- name: clean deploy folder | |
run: | | |
rm ./data/${{ env.AREA }}.osm.pbf | |
rm ./data/${{ env.AREA }}.mbtiles | |
- name: deploy to gh-pages | |
uses: JamesIves/[email protected] | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: data # The folder the action should deploy. |