@@ -2,52 +2,74 @@ name: Build Docker Image, Push to GHCR
22
33on :
44 push :
5- # Publish HEAD of main branch as :latest image tag
65 branches : [ "main", "ohm" ]
7- # Publish semver tags as named image tags
8- # tags: [ 'v*.*.*' ]
96
107env :
118 REGISTRY : ghcr.io
129 IMAGE_NAME : openhistoricalmap/osmcha-frontend
10+ REACT_APP_PAGE_SIZE : " 25"
11+ REACT_APP_OVERPASS_BASE : " //overpass-api.openhistoricalmap.org/api/interpreter"
12+ REACT_APP_MAPBOX_ACCESS_TOKEN : " pk.eyJ1Ijoib3Blbmhpc3RvcmljYWxtYXAiLCJhIjoiY202a3ZqcHN1MDJnYzJpcHhlczVqbXBuNiJ9.DvNrZEF1ISEluA9k-MSHtA"
13+ REACT_APP_OSM_URL : " https://www.openhistoricalmap.org"
14+ REACT_APP_OSM_API : " https://api.openhistoricalmap.org/api/0.6"
15+ REACT_APP_NOMINATIM_URL : " https://nominatim-api.openhistoricalmap.org/search.php"
16+ REACT_APP_DEFAULT_FROM_DATE : " 2"
17+ REACT_APP_DEFAULT_TO_DATE : " 5"
18+ REACT_APP_DISABLE_REAL_CHANGESETS : " false"
1319
1420jobs :
1521 build :
1622 runs-on : ubuntu-latest
1723
1824 steps :
19- - name : Checkout code
20- uses : actions/checkout@v4
21-
22- # Enable BuildKit for docker builds. This enables building
23- # multi-platform images and exporting the layer cache
24- # https://github.com/docker/setup-buildx-action
25- - name : Set up Docker Buildx
26- uses : docker/setup-buildx-action@v3
27-
28- # https://github.com/docker/login-action
29- - name : Login to Registry ${{ env.REGISTRY }}
30- uses : docker/login-action@v3
31- with :
32- registry : ${{ env.REGISTRY }}
33- username : ${{ github.actor }}
34- password : ${{ secrets.GITHUB_TOKEN }}
35-
36- # Extract metadata (tags, labels) for Docker
37- # https://github.com/docker/metadata-action
38- - name : Extract Docker metadata
39- id : meta
40- uses : docker/metadata-action@v5
41- with :
42- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43-
44- # https://github.com/docker/build-push-action
45- - name : Build and push Docker image
46- uses : docker/build-push-action@v5
47- with :
48- context : .
49- push : true
50- tags : ${{ steps.meta.outputs.tags }}
51- labels : ${{ steps.meta.outputs.labels }}
52- cache-from : type=gha
53- cache-to : type=gha,mode=max
25+ - name : Checkout code
26+ uses : actions/checkout@v4
27+
28+ - name : Set up Node.js
29+ uses : actions/setup-node@v4
30+ with :
31+ node-version : 20
32+
33+ - name : Install dependencies
34+ run : yarn install
35+
36+ - name : Build React App with Environment Variables
37+ run : |
38+ echo "REACT_APP_PAGE_SIZE=${{ env.REACT_APP_PAGE_SIZE }}" >> .env
39+ echo "REACT_APP_OVERPASS_BASE=${{ env.REACT_APP_OVERPASS_BASE }}" >> .env
40+ echo "REACT_APP_MAPBOX_ACCESS_TOKEN=${{ env.REACT_APP_MAPBOX_ACCESS_TOKEN }}" >> .env
41+ echo "REACT_APP_OSM_URL=${{ env.REACT_APP_OSM_URL }}" >> .env
42+ echo "REACT_APP_OSM_API=${{ env.REACT_APP_OSM_API }}" >> .env
43+ echo "REACT_APP_NOMINATIM_URL=${{ env.REACT_APP_NOMINATIM_URL }}" >> .env
44+ echo "REACT_APP_DEFAULT_FROM_DATE=${{ env.REACT_APP_DEFAULT_FROM_DATE }}" >> .env
45+ echo "REACT_APP_DEFAULT_TO_DATE=${{ env.REACT_APP_DEFAULT_TO_DATE }}" >> .env
46+ echo "REACT_APP_DISABLE_REAL_CHANGESETS=${{ env.REACT_APP_DISABLE_REAL_CHANGESETS }}" >> .env
47+
48+ cat .env # Debugging: check if env variables are set correctly
49+ yarn build
50+
51+ - name : Set up Docker Buildx
52+ uses : docker/setup-buildx-action@v3
53+
54+ - name : Login to Registry
55+ uses : docker/login-action@v3
56+ with :
57+ registry : ${{ env.REGISTRY }}
58+ username : ${{ github.actor }}
59+ password : ${{ secrets.GITHUB_TOKEN }}
60+
61+ - name : Extract Docker metadata
62+ id : meta
63+ uses : docker/metadata-action@v5
64+ with :
65+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
67+ - name : Build and push Docker image
68+ uses : docker/build-push-action@v5
69+ with :
70+ context : .
71+ push : true
72+ tags : ${{ steps.meta.outputs.tags }}
73+ labels : ${{ steps.meta.outputs.labels }}
74+ cache-from : type=gha
75+ cache-to : type=gha,mode=max
0 commit comments