Add /build-info page displaying
All checks were successful
/ build (push) Successful in 1m16s
/ deploy (push) Successful in 16s

Add page displaying information about the deployment for diagnostic
purposes.
This commit is contained in:
Hornwitser 2025-05-20 00:07:58 +02:00
parent ded212f03f
commit 742be649eb
3 changed files with 67 additions and 1 deletions

View file

@ -22,8 +22,16 @@ jobs:
echo "https://runner:${{ secrets.GITHUB_TOKEN }}@$(echo "${{ github.server_url }}" | cut -b 9-)" > ~/.git-credentials
git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} ${{ github.workspace }}
-
name: Build and push
name: Write build info
shell: bash
run: |
cat > ${{ github.workspace }}/shared/utils/build-info.ts <<EOF
export const BUILDER = "forgejo-runner";
export const GIT_REF = "${{ github.ref_name }}";
export const GIT_SHA = "${{ github.sha }}";
EOF
-
name: Build and push
run: |
podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }}
podman push ${{ env.REGISTRY_IMAGE }}

54
pages/build-info.vue Normal file
View file

@ -0,0 +1,54 @@
<template>
<main>
<h1>
Build Info
</h1>
<dl>
<dt>Builder:</dt><dd>{{ builder }}</dd>
<dt>Git Ref:</dt><dd>{{ gitRef }}</dd>
<dt>Git Commit:</dt><dd>{{ gitCommit }}</dd>
<dt>App mode:</dt><dd>{{ appMode }}</dd>
<dt>Base URL:</dt><dd>{{ baseUrl }}</dd>
<dt>NODE_ENV:</dt><dd>{{ nodeEnv }}</dd>
<dt>Server Side:</dt><dd data-allow-mismatch="text">{{ serverSide }}</dd>
<dt>Dev server:</dt><dd>{{ devServer }}</dd>
<dt>Prerender:</dt><dd data-allow-mismatch="text">{{ prerender }}</dd>
</dl>
</main>
</template>
<script setup lang="ts">
import { BUILDER, GIT_REF, GIT_SHA } from '~/shared/utils/build-info';
useHead({
title: "Build Info",
});
// App specific
const builder = BUILDER;
const gitRef = GIT_REF;
const gitCommit = GIT_SHA;
// Vite specific
const appMode = import.meta.env.MODE;
const baseUrl = import.meta.env.BASE_URL;
const prod = import.meta.env.PROD;
const dev = import.meta.env.DEV;
const nodeEnv = prod ? "production" : dev ? "development" : "unknown";
const serverSide = import.meta.env.SSR;
// Nuxt Specific
const devServer = import.meta.dev;
const prerender = import.meta.prerender;
</script>
<style scoped>
dl {
display: grid;
grid-template-columns: auto 1fr;
column-gap: 0.5em;
}
dd {
white-space: pre-wrap;
}
</style>

View file

@ -0,0 +1,4 @@
// Overwritten by build script
export const BUILDER = "";
export const GIT_REF = "";
export const GIT_SHA = "";