Skip to content

Commit 4fda7fd

Browse files
authored
Add commit hash to client sidebar (#926)
* Add commit hash to client sidebar * Fix setting env in dockerfile
1 parent 6ffc0a7 commit 4fda7fd

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.github/workflows/docker-staging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
GOOGLE_OAUTH_CLIENT_ID=${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
4343
SENTRY_INGEST_CLIENT=${{ secrets.SENTRY_INGEST_CLIENT }}
4444
SENTRY_TRACE_RATE_CLIENT=${{ secrets.SENTRY_TRACE_RATE_CLIENT }}
45+
GIT_COMMIT=${{ github.sha }}
4546
tags: |
4647
ghcr.io/csesoc/notangles-client:${{ github.sha }}
4748
ghcr.io/csesoc/notangles-client:latest

.github/workflows/docker.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
GOOGLE_OAUTH_CLIENT_ID=${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
4343
SENTRY_INGEST_CLIENT=${{ secrets.SENTRY_INGEST_CLIENT }}
4444
SENTRY_TRACE_RATE_CLIENT=${{ secrets.SENTRY_TRACE_RATE_CLIENT }}
45+
GIT_COMMIT=${{ github.sha }}
4546
tags: |
4647
ghcr.io/csesoc/notangles-client:${{ github.sha }}
4748
ghcr.io/csesoc/notangles-client:latest
@@ -122,4 +123,4 @@ jobs:
122123
git commit -m "feat(notangles): update images"
123124
git push -u origin update/notangles/${{ github.sha }}
124125
gh pr create -B migration --title "feat(notangles): update images" --body "Updates the images for the notangles deployment to commit csesoc/notangles@${{ github.sha }}." > URL
125-
gh pr merge $(cat URL) --squash -d
126+
gh pr merge $(cat URL) --squash -d

client/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ ENV VITE_APP_SENTRY_TRACE_RATE_CLIENT=$SENTRY_TRACE_RATE_CLIENT
2727
ENV VITE_APP_ENVIRONMENT=production
2828
ENV NODE_ENV=production
2929

30-
RUN pnpm run build
30+
ARG GIT_COMMIT
31+
RUN if [ -n "$GIT_COMMIT" ]; then export VITE_COMMIT=$GIT_COMMIT; fi && \
32+
pnpm run build
3133

3234
FROM caddy:2.8.4-alpine
3335
COPY ./Caddyfile /etc/caddy/Caddyfile

client/src/components/sidebar/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const Sidebar: React.FC = () => {
248248
{!collapsed ? (
249249
<SidebarFooterText>
250250
<Divider />
251-
<span>© DevSoc {new Date().getFullYear()}, v1.0.0</span>
251+
<span>{import.meta.env.VITE_COMMIT?.substring(0, 7) ?? 'unknown commit'}</span>
252252
</SidebarFooterText>
253253
) : (
254254
<CollapseButton collapsed={collapsed} onClick={() => handleCollapse(false)} toolTipTitle="Expand" />

0 commit comments

Comments
 (0)