Files
fam 1e04655003 ci: 统一 k8s manifest 为 apps/*/k8s/all.yaml
- 三个 app 的 5 个独立 yaml 合成单文件 all.yaml,多 doc 内显式排序,apply 不再受目录字母序影响(这是 piano-sheet run #49 NotFound 的根因)
- simpleasm/cube workflow 补 Initialize K8s resources 步骤,跟 piano-sheet 对齐;今后 manifest 改动 CI 自动 apply
- cube 的 _registry-ingress.yaml 不再需要前缀绕排序,去掉 _
2026-05-05 10:38:38 +01:00

57 lines
1.7 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: deploy cube
# app #0:cube.famzheng.me 入口门户。host shell runner(gnoc 用户)。
on:
push:
branches: [master]
paths:
- 'apps/cube/**'
- 'crates/cube-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.gitea/workflows/deploy-cube.yml'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest # 解析到 host shell executor(gnoc 用户),PATH 需要手动加 ~/.cargo/bin
env:
APP: cube
IMAGE: registry.famzheng.me/mochi/cube
steps:
- uses: actions/checkout@v4
- name: Resolve image tag
id: tag
run: |
echo "sha=$(git rev-parse --short=12 HEAD)" >> "$GITHUB_OUTPUT"
- name: Build rust (musl static)
run: |
export PATH="$HOME/.cargo/bin:$PATH"
cargo build --release --target x86_64-unknown-linux-musl -p "$APP"
- name: Build frontend
run: |
cd "apps/$APP/frontend"
npm ci
npm run build
- name: Build & push image
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
echo "$REGISTRY_TOKEN" | docker login registry.famzheng.me -u mochi --password-stdin
docker build -f "apps/$APP/Dockerfile" -t "$IMAGE:${{ steps.tag.outputs.sha }}" .
docker push "$IMAGE:${{ steps.tag.outputs.sha }}"
- name: Initialize K8s resources
run: |
kubectl apply -f apps/cube/k8s/all.yaml
kubectl apply -f apps/cube/k8s/registry-ingress.yaml
- name: Roll out to k3s
run: |
kubectl -n "cube-$APP" set image "deploy/$APP" "$APP=$IMAGE:${{ steps.tag.outputs.sha }}"
kubectl -n "cube-$APP" rollout status "deploy/$APP" --timeout=120s