143 lines
3.7 KiB
YAML
143 lines
3.7 KiB
YAML
name: Monorepo Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
qa:
|
|
name: 🧪 Quality Assurance
|
|
runs-on: docker
|
|
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
|
|
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 & Push Images
|
|
needs: qa
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: docker
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🐳 Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: 🔐 Registry Login
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
|
|
- name: 🏗️ Build & Push Nextjs Build-Base
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
-t registry.infra.mintel.me/mintel/nextjs:$TAG \
|
|
-t registry.infra.mintel.me/mintel/nextjs:latest \
|
|
-f packages/infra/docker/Dockerfile.nextjs \
|
|
--push .
|
|
|
|
- name: 🏗️ Build & Push Production Runtime
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
-t registry.infra.mintel.me/mintel/runtime:$TAG \
|
|
-t registry.infra.mintel.me/mintel/runtime:latest \
|
|
-f packages/infra/docker/Dockerfile.runtime \
|
|
--push .
|
|
|
|
- name: 🏗️ Build & Push Gatekeeper (Product)
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
-t registry.infra.mintel.me/mintel/gatekeeper:$TAG \
|
|
-t registry.infra.mintel.me/mintel/gatekeeper:latest \
|
|
-f packages/infra/docker/Dockerfile.gatekeeper \
|
|
--push .
|
|
|
|
- name: 🏗️ Build & Push Directus (Base)
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
-t registry.infra.mintel.me/mintel/directus:$TAG \
|
|
-t registry.infra.mintel.me/mintel/directus:latest \
|
|
-f packages/infra/docker/Dockerfile.directus \
|
|
--push .
|