Skip to content

Commit

Permalink
remove azure CDN
Browse files Browse the repository at this point in the history
The output file is now deployed to github pages
  • Loading branch information
k-yle committed Dec 20, 2024
1 parent 0aa4251 commit 1adb845
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 209 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
# at 06:06am on Thursday NZST
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
sync:
runs-on: ubuntu-latest
Expand All @@ -30,10 +35,32 @@ jobs:
- name: ⏬ Install
run: |
yarn
touch .env.local
- name: 🚚 Run the conflation
run: |
yarn start
env:
AZ_CON: ${{ secrets.AZ_CON }}
# we have to deploy the client & data together, so
# rebuild the client
- name: 🛠 Build Client
id: build
run: |
cd client
yarn build
- name: 🚀 Upload dist folder
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: client/dist/

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: sync
steps:
- name: 🚀 Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ jobs:
run: |
yarn test
# this is just to check that it compiles
# the result is not deployed from here
- name: 🛠 Build Client
run: |
cd client
yarn build
- name: ⚛ Deploy Client
if: ${{ github.ref == 'refs/heads/main' }}
uses: JamesIves/[email protected]
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: client/dist
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ out
dist
coverage
.yarn/*
.env.local
client/public/*.geo.json
6 changes: 1 addition & 5 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ import { Warnings } from './pages/Warnings';
import './main.css';
import { LayerInfo } from './pages/LayerInfo';

const BASE_URL = localStorage.dev
? 'http://localhost:3000'
: 'https://linz-addr-cdn.kyle.kiwi';

export const App: React.FC = () => {
const [data, setData] = useState<Output>();
const [error, setError] = useState<unknown>();

useEffect(() => {
fetch(`${BASE_URL}/place-names.osmPatch.geo.json`)
fetch('./place-names.osmPatch.geo.json')
.then((r) => r.json())
.then(setData)
.catch(setError);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
"client"
],
"scripts": {
"start": "node --import tsx --env-file=.env.local src/main",
"start": "node --import tsx src/main",
"lint": "eslint . && tsc",
"test": "vitest"
},
"dependencies": {
"@azure/storage-blob": "^12.23.0",
"csv-parser": "^3.0.0",
"typescript": "^5.4.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export const configRawPath = path.join(tempFolder, 'raw-config.json');

export const outputFile = path.join(
tempFolder,
'place-names.osmPatch.geo.json',
'../client/public/place-names.osmPatch.geo.json',
);
7 changes: 4 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { promises as fs } from 'node:fs';
import { tempFolder } from './core/constants.js';
import { dirname } from 'node:path';
import { outputFile, tempFolder } from './core/constants.js';
import { fetchNzgb } from './api/nzgb.js';
import { fetchOsm } from './api/osm.js';
import { fetchWikidata } from './api/wikidata.js';
import { transformWikidata } from './transformer/wikidata.js';
import { transformOsm } from './transformer/osm.js';
import { transformNzgb } from './transformer/nzgb.js';
import { conflate } from './conflate/index.js';
import { upload } from './upload/upload.js';
import { fetchConfig } from './api/config.js';

async function main() {
Expand All @@ -24,7 +24,8 @@ async function main() {

const result = await conflate({ nzgb, osm, wikidata, config });

await upload(result);
await fs.mkdir(dirname(outputFile), { recursive: true });
await fs.writeFile(outputFile, JSON.stringify(result, null, 2));
}

await main();
34 changes: 0 additions & 34 deletions src/upload/upload.ts

This file was deleted.

154 changes: 2 additions & 152 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,148 +15,6 @@ __metadata:
languageName: node
linkType: hard

"@azure/abort-controller@npm:^2.0.0, @azure/abort-controller@npm:^2.1.2":
version: 2.1.2
resolution: "@azure/abort-controller@npm:2.1.2"
dependencies:
tslib: "npm:^2.6.2"
checksum: 10c0/3771b6820e33ebb56e79c7c68e2288296b8c2529556fbd29cf4cf2fbff7776e7ce1120072972d8df9f1bf50e2c3224d71a7565362b589595563f710b8c3d7b79
languageName: node
linkType: hard

"@azure/core-auth@npm:^1.4.0, @azure/core-auth@npm:^1.8.0":
version: 1.9.0
resolution: "@azure/core-auth@npm:1.9.0"
dependencies:
"@azure/abort-controller": "npm:^2.0.0"
"@azure/core-util": "npm:^1.11.0"
tslib: "npm:^2.6.2"
checksum: 10c0/b7d8f33b81a8c9a76531acacc7af63d888429f0d763bb1ab8e28e91ddbf1626fc19cf8ca74f79c39b0a3e5acb315bdc4c4276fb979816f315712ea1bd611273d
languageName: node
linkType: hard

"@azure/core-client@npm:^1.3.0, @azure/core-client@npm:^1.6.2":
version: 1.9.2
resolution: "@azure/core-client@npm:1.9.2"
dependencies:
"@azure/abort-controller": "npm:^2.0.0"
"@azure/core-auth": "npm:^1.4.0"
"@azure/core-rest-pipeline": "npm:^1.9.1"
"@azure/core-tracing": "npm:^1.0.0"
"@azure/core-util": "npm:^1.6.1"
"@azure/logger": "npm:^1.0.0"
tslib: "npm:^2.6.2"
checksum: 10c0/4dab1f3b070f7c2c5a8390f81c7afdf31c030ad0599e75e16b9684959fb666cb57d34b63977639a60a7535f63f30a8a708210e8e48ff68a30732b7518044ebce
languageName: node
linkType: hard

"@azure/core-http-compat@npm:^2.0.0":
version: 2.1.2
resolution: "@azure/core-http-compat@npm:2.1.2"
dependencies:
"@azure/abort-controller": "npm:^2.0.0"
"@azure/core-client": "npm:^1.3.0"
"@azure/core-rest-pipeline": "npm:^1.3.0"
checksum: 10c0/e7b5374819d740c96c075956c756a753b7e9f6d7774bbadcc5000c3c4f808554e4d7146ccde7b94bcb21c39ed4a7e5b043b2a3b7d208b959310ea7e1440decca
languageName: node
linkType: hard

"@azure/core-lro@npm:^2.2.0":
version: 2.7.2
resolution: "@azure/core-lro@npm:2.7.2"
dependencies:
"@azure/abort-controller": "npm:^2.0.0"
"@azure/core-util": "npm:^1.2.0"
"@azure/logger": "npm:^1.0.0"
tslib: "npm:^2.6.2"
checksum: 10c0/bee809e47661b40021bbbedf88de54019715fdfcc95ac552b1d901719c29d78e293eeab51257b8f5155aac768eb4ea420715004d00d6e32109f5f97db5960d39
languageName: node
linkType: hard

"@azure/core-paging@npm:^1.1.1":
version: 1.6.2
resolution: "@azure/core-paging@npm:1.6.2"
dependencies:
tslib: "npm:^2.6.2"
checksum: 10c0/c727782f8dc66eff50c03421af2ca55f497f33e14ec845f5918d76661c57bc8e3a7ca9fa3d39181287bfbfa45f28cb3d18b67c31fd36bbe34146387dbd07b440
languageName: node
linkType: hard

"@azure/core-rest-pipeline@npm:^1.10.1, @azure/core-rest-pipeline@npm:^1.3.0, @azure/core-rest-pipeline@npm:^1.9.1":
version: 1.18.1
resolution: "@azure/core-rest-pipeline@npm:1.18.1"
dependencies:
"@azure/abort-controller": "npm:^2.0.0"
"@azure/core-auth": "npm:^1.8.0"
"@azure/core-tracing": "npm:^1.0.1"
"@azure/core-util": "npm:^1.11.0"
"@azure/logger": "npm:^1.0.0"
http-proxy-agent: "npm:^7.0.0"
https-proxy-agent: "npm:^7.0.0"
tslib: "npm:^2.6.2"
checksum: 10c0/e63d110f799a74ed20925e59ee70eced355f76130a2283393ce109b49365c97a436e8ddde29badee138c17cf0ecf33c26b9ce3cfbf64cf98b904ab50e6bdedff
languageName: node
linkType: hard

"@azure/core-tracing@npm:^1.0.0, @azure/core-tracing@npm:^1.0.1, @azure/core-tracing@npm:^1.1.2":
version: 1.2.0
resolution: "@azure/core-tracing@npm:1.2.0"
dependencies:
tslib: "npm:^2.6.2"
checksum: 10c0/7cd114b3c11730a1b8b71d89b64f9d033dfe0710f2364ef65645683381e2701173c08ff8625a0b0bc65bb3c3e0de46c80fdb2735e37652425489b65a283f043d
languageName: node
linkType: hard

"@azure/core-util@npm:^1.11.0, @azure/core-util@npm:^1.2.0, @azure/core-util@npm:^1.6.1":
version: 1.11.0
resolution: "@azure/core-util@npm:1.11.0"
dependencies:
"@azure/abort-controller": "npm:^2.0.0"
tslib: "npm:^2.6.2"
checksum: 10c0/245c93ec7fb3f2cb3a0b2f3a3be8d02ee401acba3cdd71620aa9e4e3ca50d831849f692332327bdbe1238ab979a76218f16a5166488ee31d5b67004298d110a3
languageName: node
linkType: hard

"@azure/core-xml@npm:^1.4.3":
version: 1.4.4
resolution: "@azure/core-xml@npm:1.4.4"
dependencies:
fast-xml-parser: "npm:^4.4.1"
tslib: "npm:^2.6.2"
checksum: 10c0/92c643a9b80272b27a7bf9b756627f21beec5289995f3188099f056d255de702e1f8959bfc0f14d7445a1f6da4d037957ba47d757545ade5e77f610c4124c3fa
languageName: node
linkType: hard

"@azure/logger@npm:^1.0.0":
version: 1.1.4
resolution: "@azure/logger@npm:1.1.4"
dependencies:
tslib: "npm:^2.6.2"
checksum: 10c0/5bc7792ef334e18f4893814e83cc61780a0effb927ba898095c75df1a01e1f3093dc7a63b6de549694cef76c25f43db850b82a48ec0fab5f9f1c1d2053af791d
languageName: node
linkType: hard

"@azure/storage-blob@npm:^12.23.0":
version: 12.26.0
resolution: "@azure/storage-blob@npm:12.26.0"
dependencies:
"@azure/abort-controller": "npm:^2.1.2"
"@azure/core-auth": "npm:^1.4.0"
"@azure/core-client": "npm:^1.6.2"
"@azure/core-http-compat": "npm:^2.0.0"
"@azure/core-lro": "npm:^2.2.0"
"@azure/core-paging": "npm:^1.1.1"
"@azure/core-rest-pipeline": "npm:^1.10.1"
"@azure/core-tracing": "npm:^1.1.2"
"@azure/core-util": "npm:^1.6.1"
"@azure/core-xml": "npm:^1.4.3"
"@azure/logger": "npm:^1.0.0"
events: "npm:^3.0.0"
tslib: "npm:^2.2.0"
checksum: 10c0/069b7a85dddb33ee793efd74fbc1a3377c6d14dbb11094c2ebae87e324f16d23292806d5dcdf04280456dafc4d960e847968f6f01e384039b47363d61faf1017
languageName: node
linkType: hard

"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.25.9, @babel/code-frame@npm:^7.26.0":
version: 7.26.2
resolution: "@babel/code-frame@npm:7.26.2"
Expand Down Expand Up @@ -3245,13 +3103,6 @@ __metadata:
languageName: node
linkType: hard

"events@npm:^3.0.0":
version: 3.3.0
resolution: "events@npm:3.3.0"
checksum: 10c0/d6b6f2adbccbcda74ddbab52ed07db727ef52e31a61ed26db9feb7dc62af7fc8e060defa65e5f8af9449b86b52cc1a1f6a79f2eafcf4e62add2b7a1fa4a432f6
languageName: node
linkType: hard

"execa@npm:^8.0.1":
version: 8.0.1
resolution: "execa@npm:8.0.1"
Expand Down Expand Up @@ -3727,7 +3578,7 @@ __metadata:
languageName: node
linkType: hard

"https-proxy-agent@npm:^7.0.0, https-proxy-agent@npm:^7.0.1":
"https-proxy-agent@npm:^7.0.1":
version: 7.0.5
resolution: "https-proxy-agent@npm:7.0.5"
dependencies:
Expand Down Expand Up @@ -4901,7 +4752,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "place-name-conflation@workspace:."
dependencies:
"@azure/storage-blob": "npm:^12.23.0"
"@types/geojson": "npm:^7946.0.14"
"@types/node": "npm:^20.14.0"
csv-parser: "npm:^3.0.0"
Expand Down Expand Up @@ -5870,7 +5720,7 @@ __metadata:
languageName: node
linkType: hard

"tslib@npm:^2.2.0, tslib@npm:^2.6.2, tslib@npm:^2.6.3":
"tslib@npm:^2.6.2, tslib@npm:^2.6.3":
version: 2.8.1
resolution: "tslib@npm:2.8.1"
checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62
Expand Down

0 comments on commit 1adb845

Please sign in to comment.