chore(deps): update dependency @types/node to ^22.10.7 #120
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: 'Tiles File' | |
on: | |
workflow_dispatch: | |
inputs: | |
file_name: | |
description: 'The name of the file to deploy, defaults to newest file' | |
required: false | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- ".github/workflows/tiles-file.yml" | |
- "map-styles/**" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
deploy_tiles: | |
name: Deploy Tiles & Styles | |
strategy: | |
matrix: | |
bucket_region: [ "wnam", "enam", "weur", "eeur", "apac", "oc" ] | |
defaults: | |
run: | |
working-directory: 'map-styles' | |
runs-on: ubuntu-latest | |
outputs: | |
KEY: ${{ steps.latest_build.outputs.KEY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'map-styles/.nvmrc' | |
- name: Install dependencies | |
run: npm ci | |
- name: Generate styles | |
run: npm run generate | |
- name: Find latest pmtiles build | |
id: latest_build | |
env: | |
FILE_NAME: ${{ github.event.inputs.file_name }} | |
run: | | |
if [ -z "$FILE_NAME" ]; then | |
build=$(curl -s https://build-metadata.protomaps.dev/builds.json | jq -r 'map(.key) | sort | last') | |
else | |
build=$FILE_NAME | |
fi | |
export build=${build%.pmtiles} | |
echo "KEY=$build" | |
echo "KEY=$build" >> $GITHUB_OUTPUT | |
- name: Setup Rclone | |
uses: AnimMouse/setup-rclone@v1 | |
with: | |
disable_base64: true | |
rclone_config: | | |
[r2] | |
type = s3 | |
provider = Cloudflare | |
region = auto | |
endpoint = https://601adaaa1eab190cdfe2945f9a6c89d0.r2.cloudflarestorage.com | |
access_key_id = ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_ID }} | |
secret_access_key = ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_HASHED_VALUE }} | |
[pmtiles] | |
type = http | |
url = https://build.protomaps.com/ | |
- name: Copy latest styles to R2 | |
run: rclone --progress copy ./dist/ r2:/tiles-${{ matrix.bucket_region }}/${{ steps.latest_build.outputs.KEY }}/styles/ --s3-no-check-bucket --s3-chunk-size=64M --multi-thread-streams=50 --checkers=512 | |
- name: Copy latest tiles to R2 | |
run: rclone --progress copyto pmtiles:/${{ steps.latest_build.outputs.KEY }}.pmtiles r2:/tiles-${{ matrix.bucket_region }}/${{ steps.latest_build.outputs.KEY }}/tiles.pmtiles --s3-no-check-bucket --s3-chunk-size=64M --multi-thread-streams=50 --checkers=512 | |
update_tile_ref: | |
name: Update tile server file reference | |
needs: [deploy_tiles] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate a token | |
id: generate-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.PUSH_O_MATIC_APP_ID }} | |
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }} | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Update deployment file name | |
run: | | |
sed -i -E 's/"pmtiles_deployment_key": "(.*)"/"pmtiles_deployment_key": "${{ needs.deploy_tiles.outputs.KEY }}"/' deployment/modules/cloudflare/tiles-worker/tiles.tfvars.json | |
- name: Push updated tiles.tfvars to repo | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: deployment/modules/cloudflare/tiles-worker/tiles.tfvars.json | |
message: Update tile server file to ${{ needs.deploy_tiles.outputs.KEY }} | |
push: ${{ github.event_name == 'workflow_dispatch' }} |