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
22 changes: 18 additions & 4 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,15 +24,23 @@ 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: |
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
fi
echo "Image tag: ${{ steps.tag.outputs.env_tag }}"

- name: Build and push Docker image
uses: docker/build-push-action@v6
Expand All @@ -40,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 }}



5 changes: 5 additions & 0 deletions labman/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion labman/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "labman",
"version": "0.1.0",
"version": "1.0.0",
"type": "module",
"private": true,
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion labman/src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down Expand Up @@ -42,7 +45,7 @@ export default function Home() {
</form>
</div>
</div>
<p className={"text-gray-300 text-2xl mb-3 ml-3 fixed bottom-0"}>v1.0.0</p>
<p className={"text-gray-300 text-2xl mb-3 ml-3 fixed bottom-0"}>{version}-{env}</p>
</>


Expand Down
Loading