Add version tags to Docker image & display on frontend

This commit is contained in:
Joel Biddle
2023-10-03 05:55:36 +00:00
parent bd8c17d720
commit 95af82963f
3 changed files with 29 additions and 4 deletions

View File

@@ -39,7 +39,10 @@ jobs:
token: ${{ secrets.DEPOT_PROJECT_TOKEN }}
load: true
context: backend
tags: infisical/backend:test
tags: |
infisical/backend:${{ steps.extract_version.outputs.version }}
labels: |
version=${{ steps.extract_version.outputs.version }}
- name: ⏻ Spawn backend container and dependencies
run: |
docker compose -f .github/resources/docker-compose.be-test.yml up --wait --quiet-pull
@@ -58,9 +61,10 @@ jobs:
context: backend
tags: |
infisical/backend:${{ steps.commit.outputs.short }}
infisical/backend:latest
infisical/backend:${{ steps.extract_version.outputs.version }}
platforms: linux/amd64,linux/arm64
labels: |
version=${{ steps.extract_version.outputs.version }}
frontend-image:
name: Build frontend image
@@ -90,9 +94,22 @@ jobs:
token: ${{ secrets.DEPOT_PROJECT_TOKEN }}
project: 64mmf0n610
context: frontend
tags: infisical/frontend:test
tags: |
infisical/frontend:${{ steps.extract_version.outputs.version }}
build-args: |
POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }}
labels: |
version=${{ steps.extract_version.outputs.version }}
- name: 🛠️ Create or update Infisical version in version.ts file
run: |
version='${{ steps.extract_version.outputs.version }}'
file='frontend/src/version.ts'
touch "$file"
if grep -q "export const CURRENT_INFISICAL_VERSION = '.*';" "$file"; then
sed -i "s/export const CURRENT_INFISICAL_VERSION = '.*';/export const CURRENT_INFISICAL_VERSION = '$version';/" "$file"
else
echo "export const INFISICAL_VERSION = '$version';" >> "$file"
fi
- name: ⏻ Spawn frontend container
run: |
docker run -d --rm --name infisical-frontend-test infisical/frontend:test
@@ -111,8 +128,9 @@ jobs:
context: frontend
tags: |
infisical/frontend:${{ steps.commit.outputs.short }}
infisical/frontend:latest
infisical/frontend:${{ steps.extract_version.outputs.version }}
platforms: linux/amd64,linux/arm64
build-args: |
POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }}
labels: |
version=${{ steps.extract_version.outputs.version }}

View File

@@ -21,6 +21,7 @@ import {
faCheck,
faEnvelope,
faInfinity,
faInfo,
faMobile,
faPlus,
faQuestion
@@ -68,6 +69,7 @@ import {
useLogoutUser,
useUploadWsKey
} from "@app/hooks/api";
import { CURRENT_INFISICAL_VERSION } from "@app/version"
interface LayoutProps {
children: React.ReactNode;
@@ -696,6 +698,10 @@ export const AppLayout = ({ children }: LayoutProps) => {
</div>
</button>
)}
<div className="mb-2 w-full pl-5 duration-200 hover:text-mineshaft-200">
<FontAwesomeIcon icon={faInfo} className="mr-4 px-[0.1rem]" />
Current version: {CURRENT_INFISICAL_VERSION}
</div>
</div>
</nav>
</aside>

1
frontend/src/version.ts Normal file
View File

@@ -0,0 +1 @@
export const CURRENT_INFISICAL_VERSION = "v1.1.1"; // placeholder - dynamically updated on prod build