Update tiles #399
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: Update tiles | |
on: | |
push: | |
paths: | |
- .github/workflows/update-tiles.yml | |
- "tiles/**/*" | |
branches: | |
- "main" | |
schedule: | |
- cron: "0 5 * * *" | |
workflow_dispatch: | |
jobs: | |
update-tiles: | |
environment: Tiles | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install osmconvert | |
run: | | |
wget http://m.m.i24.cc/osmconvert64 | |
chmod +x osmconvert64 | |
- name: Install pmtiles | |
run: | | |
wget https://github.com/protomaps/go-pmtiles/releases/download/v1.9.2/go-pmtiles_1.9.2_Linux_x86_64.tar.gz | |
tar -zxvf go-pmtiles_1.9.2_Linux_x86_64.tar.gz pmtiles | |
- name: Download OSM data | |
run: wget https://download.openstreetmap.fr/extracts/oceania/australia/new_south_wales.osm.pbf | |
- name: Crop OSM data | |
run: ./osmconvert64 new_south_wales.osm.pbf -o=data.osm.pbf --complete-ways -B=tiles/bbox.poly | |
- name: Download coastline | |
run: wget https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip | |
- name: Extract coastline | |
run: unzip -j -d coastline water-polygons-split-4326.zip | |
# https://github.com/systemed/tilemaker/blob/master/docs/RUNNING.md#github-action | |
- name: Generate tiles | |
uses: systemed/tilemaker@master | |
with: | |
# Required, same to --input | |
input: data.osm.pbf | |
# Required, same to --output. Could be a directory or a .mbtiles files | |
output: map.mbtiles | |
# Optional, same to --config | |
# If not being set, default to resources/config-openmaptiles.config | |
config: tiles/config.json | |
# Optional, same to --process | |
# If not being set, default to resources/process-openmaptiles.lua | |
process: tiles/process.lua | |
# Optional, other arguments | |
# If not being set, default to '--verbose' | |
# extra: --threads 0 | |
- name: Convert mbtiles to pmtiles | |
run: ./pmtiles convert map.mbtiles map.pmtiles | |
# https://github.com/cloudflare/wrangler-action#readme | |
- name: Publish to Cloudflare R2 | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: r2 object put sydneybikemap-tiles/map.pmtiles --file=map.pmtiles | |
packageManager: npm |