From 2ee01162d86f32843394e51c9001b9738634ee09 Mon Sep 17 00:00:00 2001 From: Ola Bekkevold Date: Mon, 23 Mar 2026 14:43:54 +0100 Subject: [PATCH 1/5] feat: signify test in versioning --- labman/src/app/(auth)/login/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labman/src/app/(auth)/login/page.tsx b/labman/src/app/(auth)/login/page.tsx index e6b1b15..5438674 100644 --- a/labman/src/app/(auth)/login/page.tsx +++ b/labman/src/app/(auth)/login/page.tsx @@ -42,7 +42,7 @@ export default function Home() { -

v1.0.0

+

v1.0.0-test

From e22439ffddb9f1c0530f0d73a866c2c5a807214e Mon Sep 17 00:00:00 2001 From: Ola Bekkevold Date: Mon, 23 Mar 2026 14:59:13 +0100 Subject: [PATCH 2/5] feat: debug determined image tag --- .github/workflows/build-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index a279f1e..234f168 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -31,6 +31,7 @@ jobs: else echo "env_tag=test" >> $GITHUB_OUTPUT fi + echo "Image tag: ${{ steps.tag.outputs.env_tag }}" - name: Build and push Docker image uses: docker/build-push-action@v6 From 563ed6a838b3ea5945bd6457dffd0388fa9662fe Mon Sep 17 00:00:00 2001 From: Ola Bekkevold Date: Mon, 23 Mar 2026 16:19:16 +0100 Subject: [PATCH 3/5] fix: refer to the correct branch --- .github/workflows/build-push.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 234f168..6cf337a 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -14,6 +14,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_sha }} - name: Log in to container registry uses: docker/login-action@v3 @@ -25,8 +27,8 @@ jobs: - name: Determine image tag id: tag run: | - REF="${{ github.ref }}" - if [ "$REF" = "refs/heads/main" ]; then + BRANCH="${{ github.event.workflow_run.head_branch }}" + if [ "$BRANCH" = "main" ]; then echo "env_tag=latest" >> $GITHUB_OUTPUT else echo "env_tag=test" >> $GITHUB_OUTPUT From b18ac3a9a2bcd603871d3a8b24c5947dbb0dcf8b Mon Sep 17 00:00:00 2001 From: Ola Bekkevold Date: Tue, 24 Mar 2026 15:30:35 +0100 Subject: [PATCH 4/5] feat: retrieve version from package.json and pass as environment variable --- .github/workflows/build-push.yml | 15 +++++++++++++-- labman/Dockerfile | 5 +++++ labman/package.json | 2 +- labman/src/app/(auth)/login/page.tsx | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 6cf337a..b98d99c 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -24,6 +24,13 @@ jobs: username: olabekkevold password: ${{ secrets.PAT }} + - name: Get version from package.json + id: version + run: | + VERSION=$(jq -r '.version' ./labman/package.json) + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Version: $VERSION" + - name: Determine image tag id: tag run: | @@ -43,5 +50,9 @@ jobs: tags: | ghcr.io/olabekkevold/labmanager:${{ steps.tag.outputs.env_tag }} ghcr.io/olabekkevold/labmanager:${{ github.sha }} - - + build-args: | + NEXT_PUBLIC_VERSION=${{ steps.version.outputs.VERSION }} + NEXT_PUBLIC_ENV=${{ steps.tag.outputs.env_tag }} + + + diff --git a/labman/Dockerfile b/labman/Dockerfile index 901cabe..1a3d077 100644 --- a/labman/Dockerfile +++ b/labman/Dockerfile @@ -24,6 +24,11 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . +ARG NEXT_PUBLIC_ENV +ENV NEXT_PUBLIC_ENV=${NEXT_PUBLIC_ENV} + +ARG NEXT_PUBLIC_VERSION +ENV NEXT_PUBLIC_VERSION=${NEXT_PUBLIC_VERSION} # Next.js collects completely anonymous telemetry data about general usage. # Learn more here: https://nextjs.org/telemetry # Uncomment the following line in case you want to disable telemetry during the build. diff --git a/labman/package.json b/labman/package.json index 0389254..26ad31c 100644 --- a/labman/package.json +++ b/labman/package.json @@ -1,6 +1,6 @@ { "name": "labman", - "version": "0.1.0", + "version": "1.0.0", "type": "module", "private": true, "scripts": { diff --git a/labman/src/app/(auth)/login/page.tsx b/labman/src/app/(auth)/login/page.tsx index 5438674..b1442ca 100644 --- a/labman/src/app/(auth)/login/page.tsx +++ b/labman/src/app/(auth)/login/page.tsx @@ -42,7 +42,7 @@ export default function Home() { -

v1.0.0-test

+

{process.env.NEXT_PUBLIC_VERSION}

From 05fe569132545f3a1c5fabc29e4135cf55304128 Mon Sep 17 00:00:00 2001 From: Ola Bekkevold Date: Wed, 25 Mar 2026 10:22:58 +0100 Subject: [PATCH 5/5] feat: get public version and env variables for version details --- labman/src/app/(auth)/login/page.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/labman/src/app/(auth)/login/page.tsx b/labman/src/app/(auth)/login/page.tsx index b1442ca..e0d1443 100644 --- a/labman/src/app/(auth)/login/page.tsx +++ b/labman/src/app/(auth)/login/page.tsx @@ -8,6 +8,9 @@ export default function Home() { const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); + const version = process.env.NEXT_PUBLIC_VERSION; + const env = process.env.NEXT_PUBLIC_ENV; + async function handleSubmit(e: React.FormEvent) { e.preventDefault(); const res = await fetch("/api/login", { @@ -42,7 +45,7 @@ export default function Home() { -

{process.env.NEXT_PUBLIC_VERSION}

+

{version}-{env}