Skip to content

Commit 4535e0d

Browse files
committed
feat: Add deployment info (branch, commit, timestamp) to footer
- Created custom Footer component showing deployment metadata - Updated Dockerfile to accept build args (DEPLOY_BRANCH, DEPLOY_COMMIT, DEPLOY_TIME) - Updated GitHub Actions to pass git info during Docker build - Footer displays deployment info in collapsible section - Commit hash links to GitHub commit page - Helps verify deployments are working correctly
1 parent 8f4ec28 commit 4535e0d

File tree

4 files changed

+191
-1
lines changed

4 files changed

+191
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
push: true
4444
tags: ${{ steps.meta.outputs.tags }}
4545
labels: ${{ steps.meta.outputs.labels }}
46+
build-args: |
47+
DEPLOY_BRANCH=${{ github.ref_name }}
48+
DEPLOY_COMMIT=${{ github.sha }}
49+
DEPLOY_TIME=${{ github.event.head_commit.timestamp }}
4650
4751
- name: Image published
4852
run: |

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Stage 1: Build the Astro site
22
FROM node:20-alpine AS builder
33

4+
# Build arguments for deployment info
5+
ARG DEPLOY_BRANCH=unknown
6+
ARG DEPLOY_COMMIT=unknown
7+
ARG DEPLOY_TIME=unknown
8+
9+
# Set environment variables for Astro build
10+
ENV PUBLIC_DEPLOY_BRANCH=$DEPLOY_BRANCH
11+
ENV PUBLIC_DEPLOY_COMMIT=$DEPLOY_COMMIT
12+
ENV PUBLIC_DEPLOY_TIME=$DEPLOY_TIME
13+
414
WORKDIR /app
515

616
# Copy package files
@@ -12,7 +22,7 @@ RUN npm ci
1222
# Copy source files
1323
COPY . .
1424

15-
# Build the site
25+
# Build the site (env vars will be inlined during build)
1626
RUN npm run build
1727

1828
# Stage 2: Serve with nginx

astro.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export default defineConfig({
1313
logo: {
1414
src: './src/assets/logo.svg',
1515
},
16+
components: {
17+
Footer: './src/components/Footer.astro',
18+
},
1619
social: [
1720
{
1821
icon: 'github',

src/components/Footer.astro

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
import type { Props } from '@astrojs/starlight/props';
3+
4+
const deployBranch = import.meta.env.PUBLIC_DEPLOY_BRANCH || 'unknown';
5+
const deployCommit = import.meta.env.PUBLIC_DEPLOY_COMMIT || 'unknown';
6+
const deployTime = import.meta.env.PUBLIC_DEPLOY_TIME || new Date().toISOString();
7+
---
8+
9+
<footer class="custom-footer">
10+
<div class="footer-content">
11+
<div class="footer-main">
12+
<p>
13+
Built with <a href="https://starlight.astro.build" target="_blank" rel="noopener">Starlight</a>
14+
&bull;
15+
<a href="https://github.com/getlumos/lumos" target="_blank" rel="noopener">GitHub</a>
16+
&bull;
17+
<a href="https://github.com/getlumos/lumos/blob/main/LICENSE" target="_blank" rel="noopener">MIT License</a>
18+
</p>
19+
<p class="copyright">
20+
© 2025 LUMOS. Type-safe schemas for Solana.
21+
</p>
22+
</div>
23+
24+
<div class="deploy-info">
25+
<details>
26+
<summary>Deployment Info</summary>
27+
<dl>
28+
<div>
29+
<dt>Branch:</dt>
30+
<dd>
31+
<code>{deployBranch}</code>
32+
</dd>
33+
</div>
34+
<div>
35+
<dt>Commit:</dt>
36+
<dd>
37+
<a
38+
href={`https://github.com/getlumos/docs-lumos/commit/${deployCommit}`}
39+
target="_blank"
40+
rel="noopener"
41+
>
42+
<code>{deployCommit.substring(0, 7)}</code>
43+
</a>
44+
</dd>
45+
</div>
46+
<div>
47+
<dt>Deployed:</dt>
48+
<dd>
49+
<time datetime={deployTime}>
50+
{new Date(deployTime).toLocaleString()}
51+
</time>
52+
</dd>
53+
</div>
54+
</dl>
55+
</details>
56+
</div>
57+
</div>
58+
</footer>
59+
60+
<style>
61+
.custom-footer {
62+
border-top: 1px solid var(--sl-color-gray-5);
63+
padding: 2rem 1rem 1rem;
64+
margin-top: 4rem;
65+
background: var(--sl-color-bg);
66+
}
67+
68+
.footer-content {
69+
max-width: 72rem;
70+
margin: 0 auto;
71+
display: flex;
72+
flex-direction: column;
73+
gap: 1rem;
74+
}
75+
76+
.footer-main {
77+
text-align: center;
78+
}
79+
80+
.footer-main p {
81+
margin: 0.5rem 0;
82+
color: var(--sl-color-gray-2);
83+
font-size: 0.875rem;
84+
}
85+
86+
.footer-main a {
87+
color: var(--sl-color-text-accent);
88+
text-decoration: none;
89+
}
90+
91+
.footer-main a:hover {
92+
text-decoration: underline;
93+
}
94+
95+
.copyright {
96+
color: var(--sl-color-gray-3);
97+
font-size: 0.8125rem;
98+
}
99+
100+
.deploy-info {
101+
border-top: 1px solid var(--sl-color-gray-6);
102+
padding-top: 1rem;
103+
}
104+
105+
.deploy-info details {
106+
text-align: center;
107+
}
108+
109+
.deploy-info summary {
110+
cursor: pointer;
111+
color: var(--sl-color-gray-3);
112+
font-size: 0.75rem;
113+
user-select: none;
114+
display: inline-flex;
115+
align-items: center;
116+
gap: 0.25rem;
117+
}
118+
119+
.deploy-info summary:hover {
120+
color: var(--sl-color-text-accent);
121+
}
122+
123+
.deploy-info dl {
124+
margin-top: 0.75rem;
125+
display: inline-grid;
126+
grid-template-columns: auto 1fr;
127+
gap: 0.5rem 1rem;
128+
font-size: 0.75rem;
129+
text-align: left;
130+
}
131+
132+
.deploy-info dt {
133+
color: var(--sl-color-gray-3);
134+
font-weight: 600;
135+
}
136+
137+
.deploy-info dd {
138+
margin: 0;
139+
color: var(--sl-color-gray-2);
140+
}
141+
142+
.deploy-info code {
143+
font-family: var(--sl-font-mono);
144+
font-size: 0.6875rem;
145+
background: var(--sl-color-gray-6);
146+
padding: 0.125rem 0.375rem;
147+
border-radius: 0.25rem;
148+
}
149+
150+
.deploy-info a {
151+
color: var(--sl-color-text-accent);
152+
text-decoration: none;
153+
}
154+
155+
.deploy-info a:hover {
156+
text-decoration: underline;
157+
}
158+
159+
@media (max-width: 50rem) {
160+
.custom-footer {
161+
padding: 1.5rem 1rem 1rem;
162+
}
163+
164+
.deploy-info dl {
165+
grid-template-columns: 1fr;
166+
gap: 0.25rem;
167+
}
168+
169+
.deploy-info dd {
170+
margin-bottom: 0.5rem;
171+
}
172+
}
173+
</style>

0 commit comments

Comments
 (0)