Skip to content

Commit

Permalink
Merge branch 'main' into more-various-small-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel-Therrien-Beslogic authored Dec 4, 2024
2 parents 6121131 + c281f84 commit 0f97619
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 14 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/canopeum_backend_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: canopeum_backend_deploy

on:
workflow_dispatch: # Allows manual builds
push:
branches:
- production
Expand All @@ -18,18 +19,24 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: 'login'
uses: docker/login-action@v1
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get datetime
id: datetime
run: echo DATETIME=$(date +'%Y-%m-%d-%H-%M') >> $GITHUB_OUTPUT
- name: Publish Docker image
id: push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: ./canopeum_backend
file: canopeum_backend/Dockerfile
push: true
tags: ghcr.io/beslogic/canopeum_backend:latest
labels: latest
tags: ghcr.io/beslogic/canopeum_backend:latest,ghcr.io/beslogic/canopeum_backend:${{steps.datetime.outputs.DATETIME}}
- name: Create and push git tag
continue-on-error: true
run: |
git tag ${{steps.datetime.outputs.DATETIME}}
git push origin --tags
17 changes: 12 additions & 5 deletions .github/workflows/canopeum_frontend_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: canopeum_frontend_deploy

on:
workflow_dispatch: # Allows manual builds
push:
branches:
- production
Expand All @@ -21,18 +22,24 @@ jobs:
run: npm ci
- name: Build project
run: npm run build
- name: 'login'
uses: docker/login-action@v1
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get datetime
id: datetime
run: echo DATETIME=$(date +'%Y-%m-%d-%H-%M') >> $GITHUB_OUTPUT
- name: Publish Docker image
id: push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: ./canopeum_frontend
file: canopeum_frontend/Dockerfile
push: true
tags: ghcr.io/beslogic/canopeum_frontend:latest
labels: latest
tags: ghcr.io/beslogic/canopeum_frontend:latest,ghcr.io/beslogic/canopeum_frontend:${{steps.datetime.outputs.DATETIME}}
- name: Create and push git tag
continue-on-error: true
run: |
git tag ${{steps.datetime.outputs.DATETIME}}
git push origin --tags
2 changes: 2 additions & 0 deletions canopeum_frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import muiCustomTheme from '@assets/styles/muiCustomTheme'
import LanguageContextProvider from '@components/context/LanguageContext'
import SnackbarContextProvider from '@components/context/SnackbarContext'

console.info({ VITE_BUILD_DATE })

const App = () => (
<ThemeProvider theme={muiCustomTheme}>
<LanguageContextProvider>
Expand Down
15 changes: 11 additions & 4 deletions canopeum_frontend/src/pages/MapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ const MapPage = () => {
initialMapState = defaultMapLocation(fetchedSites)
} else {
// Otherwise focus on the user's position
initialMapState = position.coords
// NOTE: Can't spread or clone a GeolocationPosition !
initialMapState = {
longitude: position.coords.longitude,
latitude: position.coords.latitude,
}
}
setMapViewState(mvs => ({ ...mvs, ...initialMapState }))
}), [fetchData, searchParams])
Expand All @@ -153,8 +157,11 @@ const MapPage = () => {
<NavigationControl position='top-right' showCompass showZoom visualizePitch />
<ScaleControl position='bottom-left' unit='metric' />
{sites.map(site => {
const latitude = Number(site.coordinate.ddLatitude)
const longitude = Number(site.coordinate.ddLongitude)
const latitude = site.coordinate.ddLatitude
const longitude = site.coordinate.ddLongitude

// Unset or invalid coordinate should be ignored from map pins
if (!latitude || !longitude) return

return (
<Marker
Expand All @@ -168,7 +175,7 @@ const MapPage = () => {
<SiteTypePin siteTypeId={site.siteType.id as SiteTypeID} />
</Marker>
)
})}
}).filter(Boolean)}
</ReactMap>
</div>

Expand Down
1 change: 1 addition & 0 deletions canopeum_frontend/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="vite/client" />
declare const VITE_BUILD_DATE: Date
3 changes: 3 additions & 0 deletions canopeum_frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ export default ({ mode }: { mode: string }) => {
usePolling: true,
},
},
define: {
VITE_BUILD_DATE: new Date(),
},
})
}

0 comments on commit 0f97619

Please sign in to comment.