136 lines
3.4 KiB
YAML
136 lines
3.4 KiB
YAML
name: Monorepo Pipeline
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
qa:
|
|
name: 🧪 Quality Assurance
|
|
runs-on: docker
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node_version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Test
|
|
run: pnpm test
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
release:
|
|
name: 🚀 Release
|
|
needs: qa
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: docker
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node_version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: 🏷️ Release Packages (Tag-Driven)
|
|
run: |
|
|
echo "🏷️ Tag detected [${{ github.ref_name }}], performing sync release..."
|
|
pnpm sync-versions
|
|
pnpm release:tag
|
|
|
|
build-images:
|
|
name: 🐳 Build ${{ matrix.name }}
|
|
needs: qa
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: docker
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- image: nextjs
|
|
file: packages/infra/docker/Dockerfile.nextjs
|
|
name: Build-Base
|
|
- image: runtime
|
|
file: packages/infra/docker/Dockerfile.runtime
|
|
name: Production Runtime
|
|
- image: gatekeeper
|
|
file: packages/infra/docker/Dockerfile.gatekeeper
|
|
name: Gatekeeper (Product)
|
|
- image: directus
|
|
file: packages/infra/docker/Dockerfile.directus
|
|
name: Directus (Base)
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🐳 Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: 🔐 Registry Login
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: registry.infra.mintel.me
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASS }}
|
|
|
|
- name: 🏗️ Build & Push ${{ matrix.name }}
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.file }}
|
|
platforms: linux/arm64
|
|
pull: true
|
|
push: true
|
|
secrets: |
|
|
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
|
|
tags: |
|
|
registry.infra.mintel.me/mintel/${{ matrix.image }}:${{ github.ref_name }}
|
|
registry.infra.mintel.me/mintel/${{ matrix.image }}:latest
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|