Skip to content

Commit

Permalink
feat: display version in frontend (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkEzz authored Jan 3, 2022
1 parent 689c2d3 commit a533395
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:

- name: Build and push
uses: docker/build-push-action@v2
env:
VITE_SATTRACK_VERSION: ${{ github.ref_name }}
with:
context: .
file: ./Dockerfile
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ RUN npm i && npm run build

FROM debian:bullseye as sattrack_runner

ENV VITE_SATTRACK_VERSION=devel

RUN apt-get update && apt-get install curl -y
WORKDIR /app
COPY --from=sattrack-back_builder /app/sattrack .
Expand Down
1 change: 1 addition & 0 deletions js/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_SATTRACK_VERSION=devel
6 changes: 5 additions & 1 deletion js/src/components/UI/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { Navbar as BSNavbar, Container, Nav } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import getVersion from '../../utils/getVersion';

function Navbar() {
return (
<BSNavbar bg="dark" className="navbar-dark mb-3" expand="lg">
<Container>
<BSNavbar.Brand href="#home">SatTrack</BSNavbar.Brand>
<BSNavbar.Brand href="#home">
SatTrack
<small className="ms-1 fs-6 text-muted">{getVersion()}</small>
</BSNavbar.Brand>
<BSNavbar.Toggle aria-controls="basic-navbar-nav" />
<BSNavbar.Collapse id="basic-navbar-nav">
<Nav>
Expand Down
5 changes: 5 additions & 0 deletions js/src/utils/getVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function getVersion(): string {
return String(import.meta.env?.VITE_SATTRACK_VERSION) ?? "no_version";
}

export default getVersion;

0 comments on commit a533395

Please sign in to comment.