Skip to content

Commit bd9bec6

Browse files
lesbaaLes Moffat
andauthored
Rd 1231 cdn release action (#100)
* RD-1231 Add CF CDN Deploy action and appease linter * RD-1231 Appease linter * RD-1231 Fix node version for build script --------- Co-authored-by: Les Moffat <les.moffat@maptiler.com>
1 parent 29f048f commit bd9bec6

File tree

4 files changed

+76
-26
lines changed

4 files changed

+76
-26
lines changed

.github/workflows/npm-publish.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
- name: Install dependencies and build
2828
run: npm ci
2929

30-
- name: Build Release
31-
run: npm run build
30+
- name: Make release
31+
run: npm run make
3232
id: makeRelease
3333

3434
- name: Fail job if makeRelease failed
@@ -39,28 +39,26 @@ jobs:
3939
- name: Publish NPM package (regular)
4040
if: "!github.event.release.prerelease"
4141
run: |
42-
npm run pub
42+
npm publish
4343
env:
4444
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4545

4646
- name: Publish NPM package (pre-release)
4747
if: "github.event.release.prerelease"
4848
run: |
49-
npm run pub-next
49+
npm publish --tag next
5050
env:
5151
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
5252

53-
- name: Send Dispatch Event to CDN Repo
54-
run: |
55-
curl -X POST \
56-
-H "Authorization: token ${{ secrets.CDN_MAPTILER_TOKEN }}" \
57-
-H "Accept: application/vnd.github.v3+json" \
58-
https://api.github.com/repos/maptiler/cdn.maptiler.com/dispatches \
59-
-d '{ \
60-
"event_type": "repo_release", \
61-
"client_payload": { \
62-
"repo": "${{ github.repository }}", \
63-
"tag": "${{ github.event.release.tag_name }}", \
64-
"build_dir": "build" \
65-
}
66-
}'
53+
- name: Get Package version
54+
id: version
55+
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
56+
- name: Publish to CDN Cloudflar R2
57+
uses: ryand56/r2-upload-action@v1.4
58+
with:
59+
r2-account-id: ${{ secrets.CDN_MAPTILER_ACCOUNT_ID }}
60+
r2-access-key-id: ${{ secrets.CDN_MAPTILER_ACCESS_KEY_ID }}
61+
r2-secret-access-key: ${{ secrets.CDN_MAPTILER_SECRET_ACCESS_KEY }}
62+
r2-bucket: cdn-storage
63+
source-dir: dist
64+
destination-dir: maptiler-geocoding-control/v${{ env.PACKAGE_VERSION }}/
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
pull_request:
8+
types: [opened]
9+
10+
jobs:
11+
test-build-and-publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.release.target_commitish }}
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
registry-url: https://registry.npmjs.org/
23+
24+
- name: Clear NPM cache
25+
run: npm cache clean --force
26+
27+
- name: Install dependencies and build
28+
run: npm ci
29+
30+
- name: Make release
31+
run: npm run make
32+
id: makeRelease
33+
34+
- name: Fail job if makeRelease failed
35+
if: steps.makeRelease.outcome == 'failure'
36+
run: exit 1
37+
38+
id: check-build-status
39+
- name: Publish NPM package (regular)
40+
if: "!github.event.release.prerelease"
41+
run: |
42+
npm publish --dry-run
43+
env:
44+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
45+
46+
- name: Publish NPM package (pre-release)
47+
if: "github.event.release.prerelease"
48+
run: |
49+
npm publish --tag next --dry-run
50+
env:
51+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
## What?
2222

23-
The *MapTiler Geocoding control* implements a powerful search box in your maps or online forms, enabling your application users to find any place on Earth down to individual addresses. Use the search box control with [MapTiler SDK JS](https://docs.maptiler.com/sdk-js/) (or other map libraries like [Leaflet](https://docs.maptiler.com/leaflet/), [MapLibre GL JS](https://github.com/maplibre/maplibre-gl-js), [OpenLayers](https://docs.maptiler.com/openlayers/)).
23+
The _MapTiler Geocoding control_ implements a powerful search box in your maps or online forms, enabling your application users to find any place on Earth down to individual addresses. Use the search box control with [MapTiler SDK JS](https://docs.maptiler.com/sdk-js/) (or other map libraries like [Leaflet](https://docs.maptiler.com/leaflet/), [MapLibre GL JS](https://github.com/maplibre/maplibre-gl-js), [OpenLayers](https://docs.maptiler.com/openlayers/)).
2424

2525
## Why?
2626

@@ -29,13 +29,13 @@ The _Geocoding control_ uses the [MapTiler Geocoding API](https://www.maptiler.c
2929
With this control, users of
3030
mapping application can:
3131

32-
* Find any place on Earth (States, Cities, Streets, Addresses, POIs, ...) down
33-
to the address level
34-
* Find and identify objects or place names using a coordinate pair or a single mouse click (reverse geocoding)
35-
* Restrict the search area to a specific country, bounding box, or proximity
36-
* Highlight searched results on the map (marker or full geometry)
37-
* Autocomplete words while typing
38-
* and much more. Check out the [Geocoding Control API reference](https://docs.maptiler.com/sdk-js/modules/geocoding/api/api-reference/#options) to see all the options.
32+
- Find any place on Earth (States, Cities, Streets, Addresses, POIs, ...) down
33+
to the address level
34+
- Find and identify objects or place names using a coordinate pair or a single mouse click (reverse geocoding)
35+
- Restrict the search area to a specific country, bounding box, or proximity
36+
- Highlight searched results on the map (marker or full geometry)
37+
- Autocomplete words while typing
38+
- and much more. Check out the [Geocoding Control API reference](https://docs.maptiler.com/sdk-js/modules/geocoding/api/api-reference/#options) to see all the options.
3939

4040
The component can be used as an ES module or UMD module with or without bundler.
4141

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"dev": "vite --host",
35+
"make": "npm run clean && npm run build",
3536
"build": "node sync-info.js run && npm run check && concurrently --names \"SVELTE ,MAPLIBRE,MAPTILER,MAPLIB-C,LEAFLET ,LEAFLE-C,OL ,OL-C ,REACT ,TYPES ,VANILLA \" \"npm run build-svelte\" \"npm run build-maplibre\" \"npm run build-maptilersdk\" \"npm run build-maplibre-controller\" \"npm run build-leaflet\" \"npm run build-leaflet-controller\" \"npm run build-openlayers\" \"npm run build-openlayers-controller\" \"npm run build-react\" \"npm run build-vanilla\" \"npm run build-types\" && cp LICENSE README.md package.json dist && cp -r dist.svelte dist/svelte",
3637
"build-svelte": "svelte-package -i src -o dist.svelte && VITE_LIB_VERSION=$npm_package_version node replace-env-vars.js",
3738
"build-maptilersdk": "FLAVOUR=maptilersdk vite build",

0 commit comments

Comments
 (0)