feat: add auto-incrementing version number (0.9.0.X) in footer
All checks were successful
Deploy to VPS / deploy (push) Successful in 38s
All checks were successful
Deploy to VPS / deploy (push) Successful in 38s
- Added version.json to track base version and build number - Updated Gitea Actions workflow to bump build number on each deploy - Footer now shows version number alongside commit hash - Version passed as build arg through Docker build pipeline Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -14,10 +14,24 @@ jobs:
|
||||
cd /home/remmer/StageAI
|
||||
git pull origin master
|
||||
|
||||
- name: Bump version
|
||||
run: |
|
||||
cd /home/remmer/StageAI
|
||||
BUILD=$(jq '.build' version.json)
|
||||
NEW_BUILD=$((BUILD + 1))
|
||||
VERSION=$(jq -r '.version' version.json)
|
||||
jq --arg b "$NEW_BUILD" '.build = ($b | tonumber)' version.json > version.tmp && mv version.tmp version.json
|
||||
echo "APP_VERSION=${VERSION}.${NEW_BUILD}" >> $GITHUB_ENV
|
||||
git config user.name "Gitea Actions"
|
||||
git config user.email "actions@gitea.local"
|
||||
git add version.json
|
||||
git commit -m "Bump build to ${VERSION}.${NEW_BUILD} [skip ci]"
|
||||
git push origin master
|
||||
|
||||
- name: Build and deploy
|
||||
run: |
|
||||
cd /home/remmer/StageAI
|
||||
export COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
docker compose build app
|
||||
docker compose build --build-arg COMMIT_HASH=$COMMIT_HASH --build-arg APP_VERSION=${{ env.APP_VERSION }} app
|
||||
docker compose up -d app
|
||||
echo "Deployed commit: $COMMIT_HASH"
|
||||
echo "Deployed version: ${{ env.APP_VERSION }} (commit: $COMMIT_HASH)"
|
||||
|
||||
@@ -8,7 +8,9 @@ RUN npm ci
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
ARG COMMIT_HASH=dev
|
||||
ARG APP_VERSION=0.9.0.1
|
||||
ENV NEXT_PUBLIC_BUILD_HASH=$COMMIT_HASH
|
||||
ENV NEXT_PUBLIC_APP_VERSION=$APP_VERSION
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
@@ -4,6 +4,7 @@ services:
|
||||
context: .
|
||||
args:
|
||||
COMMIT_HASH: ${COMMIT_HASH:-dev}
|
||||
APP_VERSION: ${APP_VERSION:-0.9.0.1}
|
||||
ports:
|
||||
- "3002:3000"
|
||||
environment:
|
||||
|
||||
@@ -14,6 +14,7 @@ const nextConfig: NextConfig = {
|
||||
serverExternalPackages: ["pdfjs-dist", "drizzle-orm", "pg"],
|
||||
env: {
|
||||
NEXT_PUBLIC_BUILD_HASH: commitHash,
|
||||
NEXT_PUBLIC_APP_VERSION: process.env.NEXT_PUBLIC_APP_VERSION || "0.9.0.1",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export default async function DashboardLayout({
|
||||
{children}
|
||||
</main>
|
||||
<footer className="px-8 py-3 text-xs text-gray-400 border-t border-gray-200">
|
||||
Build {process.env.NEXT_PUBLIC_BUILD_HASH || 'dev'}
|
||||
v{process.env.NEXT_PUBLIC_APP_VERSION || '0.9.0.1'} ({process.env.NEXT_PUBLIC_BUILD_HASH || 'dev'})
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
4
version.json
Normal file
4
version.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": "0.9.0",
|
||||
"build": 1
|
||||
}
|
||||
Reference in New Issue
Block a user