Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e843de42da | |||
| 4d1b2231e3 | |||
| 71f47f9037 |
@@ -2,13 +2,8 @@ name: Monorepo Pipeline
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -18,6 +13,8 @@ jobs:
|
|||||||
qa:
|
qa:
|
||||||
name: 🧪 Quality Assurance
|
name: 🧪 Quality Assurance
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -52,6 +49,8 @@ jobs:
|
|||||||
needs: qa
|
needs: qa
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
env:
|
env:
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -86,6 +85,8 @@ jobs:
|
|||||||
needs: qa
|
needs: qa
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -94,49 +95,52 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: 🔐 Registry Login
|
- name: 🔐 Registry Login
|
||||||
run: |
|
uses: docker/login-action@v3
|
||||||
echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
with:
|
||||||
|
registry: registry.infra.mintel.me
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASS }}
|
||||||
|
|
||||||
- name: 🏗️ Build & Push Nextjs Build-Base
|
- name: 🏗️ Build & Push Nextjs Build-Base
|
||||||
env:
|
uses: docker/build-push-action@v5
|
||||||
TAG: ${{ github.ref_name }}
|
with:
|
||||||
run: |
|
context: .
|
||||||
docker buildx build \
|
file: packages/infra/docker/Dockerfile.nextjs
|
||||||
--platform linux/amd64,linux/arm64 \
|
platforms: linux/amd64,linux/arm64
|
||||||
-t registry.infra.mintel.me/mintel/nextjs:$TAG \
|
push: true
|
||||||
-t registry.infra.mintel.me/mintel/nextjs:latest \
|
tags: |
|
||||||
-f packages/infra/docker/Dockerfile.nextjs \
|
registry.infra.mintel.me/mintel/nextjs:${{ github.ref_name }}
|
||||||
--push .
|
registry.infra.mintel.me/mintel/nextjs:latest
|
||||||
|
|
||||||
- name: 🏗️ Build & Push Production Runtime
|
- name: 🏗️ Build & Push Production Runtime
|
||||||
env:
|
uses: docker/build-push-action@v5
|
||||||
TAG: ${{ github.ref_name }}
|
with:
|
||||||
run: |
|
context: .
|
||||||
docker buildx build \
|
file: packages/infra/docker/Dockerfile.runtime
|
||||||
--platform linux/amd64,linux/arm64 \
|
platforms: linux/amd64,linux/arm64
|
||||||
-t registry.infra.mintel.me/mintel/runtime:$TAG \
|
push: true
|
||||||
-t registry.infra.mintel.me/mintel/runtime:latest \
|
tags: |
|
||||||
-f packages/infra/docker/Dockerfile.runtime \
|
registry.infra.mintel.me/mintel/runtime:${{ github.ref_name }}
|
||||||
--push .
|
registry.infra.mintel.me/mintel/runtime:latest
|
||||||
|
|
||||||
- name: 🏗️ Build & Push Gatekeeper (Product)
|
- name: 🏗️ Build & Push Gatekeeper (Product)
|
||||||
env:
|
uses: docker/build-push-action@v5
|
||||||
TAG: ${{ github.ref_name }}
|
with:
|
||||||
run: |
|
context: .
|
||||||
docker buildx build \
|
file: packages/infra/docker/Dockerfile.gatekeeper
|
||||||
--platform linux/amd64,linux/arm64 \
|
platforms: linux/amd64,linux/arm64
|
||||||
-t registry.infra.mintel.me/mintel/gatekeeper:$TAG \
|
push: true
|
||||||
-t registry.infra.mintel.me/mintel/gatekeeper:latest \
|
tags: |
|
||||||
-f packages/infra/docker/Dockerfile.gatekeeper \
|
registry.infra.mintel.me/mintel/gatekeeper:${{ github.ref_name }}
|
||||||
--push .
|
registry.infra.mintel.me/mintel/gatekeeper:latest
|
||||||
|
|
||||||
- name: 🏗️ Build & Push Directus (Base)
|
- name: 🏗️ Build & Push Directus (Base)
|
||||||
env:
|
uses: docker/build-push-action@v5
|
||||||
TAG: ${{ github.ref_name }}
|
with:
|
||||||
run: |
|
context: .
|
||||||
docker buildx build \
|
file: packages/infra/docker/Dockerfile.directus
|
||||||
--platform linux/amd64,linux/arm64 \
|
platforms: linux/amd64,linux/arm64
|
||||||
-t registry.infra.mintel.me/mintel/directus:$TAG \
|
push: true
|
||||||
-t registry.infra.mintel.me/mintel/directus:latest \
|
tags: |
|
||||||
-f packages/infra/docker/Dockerfile.directus \
|
registry.infra.mintel.me/mintel/directus:${{ github.ref_name }}
|
||||||
--push .
|
registry.infra.mintel.me/mintel/directus:latest
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ jobs:
|
|||||||
prepare:
|
prepare:
|
||||||
name: 🔍 Prepare Environment
|
name: 🔍 Prepare Environment
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
outputs:
|
outputs:
|
||||||
target: ${{ steps.determine.outputs.target }}
|
target: ${{ steps.determine.outputs.target }}
|
||||||
image_tag: ${{ steps.determine.outputs.image_tag }}
|
image_tag: ${{ steps.determine.outputs.image_tag }}
|
||||||
@@ -136,6 +138,8 @@ jobs:
|
|||||||
needs: prepare
|
needs: prepare
|
||||||
if: needs.prepare.outputs.target != 'skip'
|
if: needs.prepare.outputs.target != 'skip'
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -171,6 +175,8 @@ jobs:
|
|||||||
needs: prepare
|
needs: prepare
|
||||||
if: needs.prepare.outputs.target != 'skip'
|
if: needs.prepare.outputs.target != 'skip'
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -179,23 +185,24 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: 🔐 Registry Login
|
- name: 🔐 Registry Login
|
||||||
run: |
|
uses: docker/login-action@v3
|
||||||
echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
with:
|
||||||
|
registry: registry.infra.mintel.me
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASS }}
|
||||||
|
|
||||||
- name: 🏗️ Docker Build & Push
|
- name: 🏗️ Docker Build & Push
|
||||||
env:
|
uses: docker/build-push-action@v5
|
||||||
IMAGE_TAG: ${{ needs.prepare.outputs.image_tag }}
|
with:
|
||||||
NEXT_PUBLIC_BASE_URL: ${{ needs.prepare.outputs.next_public_base_url }}
|
context: .
|
||||||
run: |
|
platforms: linux/arm64
|
||||||
docker buildx build \
|
build-args: |
|
||||||
--pull \
|
NEXT_PUBLIC_BASE_URL=${{ needs.prepare.outputs.next_public_base_url }}
|
||||||
--platform linux/arm64 \
|
NEXT_PUBLIC_TARGET=${{ needs.prepare.outputs.target }}
|
||||||
--build-arg NEXT_PUBLIC_BASE_URL="$NEXT_PUBLIC_BASE_URL" \
|
push: true
|
||||||
--build-arg NEXT_PUBLIC_TARGET="${{ needs.prepare.outputs.target }}" \
|
tags: registry.infra.mintel.me/mintel/${{ github.event.repository.name }}:${{ needs.prepare.outputs.image_tag }}
|
||||||
-t registry.infra.mintel.me/mintel/${{ github.event.repository.name }}:$IMAGE_TAG \
|
cache-from: type=registry,ref=registry.infra.mintel.me/mintel/${{ github.event.repository.name }}:buildcache
|
||||||
--cache-from type=registry,ref=registry.infra.mintel.me/mintel/${{ github.event.repository.name }}:buildcache \
|
cache-to: type=registry,ref=registry.infra.mintel.me/mintel/${{ github.event.repository.name }}:buildcache,mode=max
|
||||||
--cache-to type=registry,ref=registry.infra.mintel.me/mintel/${{ github.event.repository.name }}:buildcache,mode=max \
|
|
||||||
--push .
|
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────────────────────
|
||||||
# JOB 4: Deploy
|
# JOB 4: Deploy
|
||||||
@@ -205,6 +212,8 @@ jobs:
|
|||||||
needs: [prepare, build, qa]
|
needs: [prepare, build, qa]
|
||||||
if: needs.prepare.outputs.target != 'skip'
|
if: needs.prepare.outputs.target != 'skip'
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
env:
|
env:
|
||||||
TARGET: ${{ needs.prepare.outputs.target }}
|
TARGET: ${{ needs.prepare.outputs.target }}
|
||||||
IMAGE_TAG: ${{ needs.prepare.outputs.image_tag }}
|
IMAGE_TAG: ${{ needs.prepare.outputs.image_tag }}
|
||||||
@@ -271,6 +280,8 @@ jobs:
|
|||||||
needs: [prepare, deploy]
|
needs: [prepare, deploy]
|
||||||
if: always()
|
if: always()
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🔔 Gotify - Success
|
- name: 🔔 Gotify - Success
|
||||||
if: needs.deploy.result == 'success'
|
if: needs.deploy.result == 'success'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { isValidLang } from "../src/index";
|
import { isValidLang } from "./lang";
|
||||||
|
|
||||||
describe("next-utils", () => {
|
describe("next-utils", () => {
|
||||||
it("should validate languages correctly", () => {
|
it("should validate languages correctly", () => {
|
||||||
|
|||||||
@@ -30,12 +30,7 @@ export async function rateLimit(
|
|||||||
submissions[identifier] = now;
|
submissions[identifier] = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const languages = ["en", "de"] as const;
|
export * from "./lang";
|
||||||
export type Lang = (typeof languages)[number];
|
|
||||||
|
|
||||||
export function isValidLang(lang: string): lang is Lang {
|
|
||||||
return (languages as readonly string[]).includes(lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
export * from "./i18n";
|
export * from "./i18n";
|
||||||
export * from "./env";
|
export * from "./env";
|
||||||
|
|||||||
6
packages/next-utils/src/lang.ts
Normal file
6
packages/next-utils/src/lang.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const languages = ["en", "de"] as const;
|
||||||
|
export type Lang = (typeof languages)[number];
|
||||||
|
|
||||||
|
export function isValidLang(lang: string): lang is Lang {
|
||||||
|
return (languages as readonly string[]).includes(lang);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user