Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
COMMIT_SHA=${{ github.sha }}

- name: Deploy to Dokploy
if: github.event_name != 'pull_request'
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM oven/bun:latest AS build

ARG COMMIT_SHA=unknown

WORKDIR /workspace

COPY package.json bun.lock ./
RUN bun install --frozen-lockfile

COPY . .
RUN bun run build
RUN COMMIT_SHA="${COMMIT_SHA}" bun run build

FROM beeman/static-server:latest

Expand Down
7 changes: 7 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import tailwindcss from '@tailwindcss/vite';
import umami from '@yeskunall/astro-umami';
import { buildStamp } from './src/integrations/build-stamp';
import { rawMarkdown } from './src/integrations/raw-markdown';

const commitSha = process.env.COMMIT_SHA || 'dev';

// https://astro.build/config
export default defineConfig({
site: 'https://colmena.dev',
integrations: [
starlight({
title: 'colmena',
head: [
{ tag: 'meta', attrs: { name: 'x-commit', content: commitSha } },
],
social: [
{ icon: 'github', label: 'GitHub', href: 'https://github.com/colmena' },
],
Expand Down Expand Up @@ -38,6 +44,7 @@ export default defineConfig({
customCss: ['./src/styles/global.css'],
}),
rawMarkdown(),
buildStamp({ sha: commitSha, repo: 'colmena/colmena-dev' }),
umami({
id: '3d447655-7d7a-4ba8-806e-74eb1831f7b8',
endpointUrl: 'https://stats.colmena.dev',
Expand Down
22 changes: 22 additions & 0 deletions src/integrations/build-stamp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import type { AstroIntegration } from 'astro';

export function buildStamp(options: { sha: string; repo: string }): AstroIntegration {
return {
name: 'build-stamp',
hooks: {
'astro:build:done': ({ dir }) => {
const { sha, repo } = options;
writeFileSync(
join(dir.pathname, 'version.json'),
JSON.stringify({
sha,
url: sha !== 'dev' ? `https://github.com/${repo}/commit/${sha}` : null,
built: new Date().toISOString(),
}),
);
},
},
};
}