100 lines
2.8 KiB
YAML
100 lines
2.8 KiB
YAML
name: CloudNativeSuite Pipeline
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
pull_request:
|
||
branches: [main]
|
||
workflow_dispatch:
|
||
inputs:
|
||
environment:
|
||
description: "Target environment"
|
||
type: choice
|
||
options: [dev, prod]
|
||
default: dev
|
||
|
||
permissions:
|
||
contents: read
|
||
packages: write
|
||
id-token: write
|
||
|
||
jobs:
|
||
|
||
# -------------------------------------------------------------
|
||
# CI — Code Quality → Build → Test → Security
|
||
# -------------------------------------------------------------
|
||
ci:
|
||
name: "CI • ${{ matrix.service }} @ ${{ matrix.platform }}"
|
||
runs-on: ubuntu-latest
|
||
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
platform: ["linux/amd64", "linux/arm64"]
|
||
service: ["dashboard", "rag-server", "account"]
|
||
steps:
|
||
- name: Code Quality
|
||
uses: ./.github/actions/code-quality
|
||
with:
|
||
service: ${{ matrix.service }}
|
||
platform: ${{ matrix.platform }}
|
||
|
||
- name: Build
|
||
uses: ./.github/actions/build
|
||
with:
|
||
service: ${{ matrix.service }}
|
||
platform: ${{ matrix.platform }}
|
||
|
||
- name: Build Base Images
|
||
uses: ./.github/workflows/build-base-images.yml
|
||
secrets: inherit
|
||
with:
|
||
registry: ghcr.io
|
||
org: cloud-neutral-toolkit
|
||
push_images: true
|
||
|
||
- name: Build Service Images
|
||
uses: ./.github/workflows/build-service-images.yml
|
||
secrets: inherit
|
||
with:
|
||
registry: ghcr.io
|
||
org: cloud-neutral-toolkit
|
||
push_images: true
|
||
node_builder_digest: ${{ steps.base.outputs.node_builder_digest }}
|
||
node_runtime_digest: ${{ steps.base.outputs.node_runtime_digest }}
|
||
postgres_runtime_digest: ${{ steps.base.outputs.postgres_runtime_digest }}
|
||
openresty_geoip_digest: ${{ steps.base.outputs.openresty_geoip_digest }}
|
||
|
||
- name: "Test • ${{ matrix.service }} @ ${{ matrix.platform }}"
|
||
steps:
|
||
uses: ./.github/actions/test
|
||
with:
|
||
service: ${{ matrix.service }}
|
||
platform: ${{ matrix.platform }}
|
||
|
||
- name: - name: Security Check
|
||
steps:
|
||
uses: ./.github/actions/security
|
||
with:
|
||
service: ${{ matrix.service }}
|
||
platform: ${{ matrix.platform }}
|
||
|
||
# -------------------------------------------------------------
|
||
# CD — Deploy(只在 workflow_dispatch 时跑)
|
||
# -------------------------------------------------------------
|
||
cd:
|
||
name: "Deploy • ${{ matrix.service }} (${{ github.event.inputs.environment }})"
|
||
runs-on: ubuntu-latest
|
||
needs: ci
|
||
if: github.event_name == 'workflow_dispatch'
|
||
|
||
env:
|
||
ENVIRONMENT: ${{ github.event.inputs.environment }}
|
||
|
||
steps:
|
||
- name: Deploy Services
|
||
uses: ./.github/actions/deploy
|
||
secrets: inherit
|
||
with:
|
||
environment: ${{ env.ENVIRONMENT }}
|