ci: added automatic versioning

Signed-off-by: Varun Raj <varun@skcript.com>
This commit is contained in:
Varun Raj
2024-11-21 19:49:31 +05:30
parent 9488f8dd83
commit bd511ce5b8
4 changed files with 5 additions and 11 deletions
+2 -2
View File
@@ -43,8 +43,8 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
run: |
docker build --build-arg BUILD_VERSION=${{ needs.release.outputs.new-release-version }} VERSION=${{ needs.release.outputs.new-release-version }} \
-t ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} \
echo VERSION=${{ needs.release.outputs.new-release-version }} >> .env
docker build -t ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} \
-t ghcr.io/${{ github.repository }}:latest .
docker push ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }}
+2
View File
@@ -3,6 +3,7 @@
# Install dependencies only when needed
FROM node:18-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
@@ -10,6 +11,7 @@ RUN npm install --frozen-lockfile
# Rebuild the source code only when needed
FROM node:18-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
-2
View File
@@ -10,5 +10,3 @@ services:
- "3000:3000"
env_file:
- .env
environment:
- BUILD_VERSION=${BUILD_VERSION}
+1 -7
View File
@@ -1,11 +1,5 @@
/** @type {import('next').NextConfig} */
import { readFileSync } from 'fs';
const { version } = JSON.parse(readFileSync('./package.json', 'utf-8'));
console.log(`Version: ${version}`);
const nextConfig = {
reactStrictMode: false,
output: 'standalone',
@@ -13,7 +7,7 @@ const nextConfig = {
unoptimized: true,
},
env: {
VERSION: process.env.BUILD_VERSION || version,
VERSION: process.env.VERSION,
},
};