name: deploy notes # notes.famzheng.me — 录音 → ASR → LLM 会议纪要 on: push: branches: [master] paths: - 'apps/notes/**' - 'crates/cube-core/**' - 'Cargo.toml' - 'Cargo.lock' - '.gitea/workflows/deploy-notes.yml' workflow_dispatch: jobs: build-and-deploy: runs-on: ubuntu-latest env: APP: notes NS: cube-notes IMAGE: registry.famzheng.me/mochi/notes FEISHU_IMAGE: registry.famzheng.me/mochi/notes-feishu 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 images env: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | echo "$REGISTRY_TOKEN" | docker login registry.famzheng.me -u mochi --password-stdin # main app —— FROM scratch + COPY musl binary,必须 --no-cache(cube docker cache 坑) docker build --no-cache -f "apps/$APP/Dockerfile" -t "$IMAGE:${{ steps.tag.outputs.sha }}" . docker push "$IMAGE:${{ steps.tag.outputs.sha }}" # feishu sidecar —— node+python+chromium-free,layer cache 帮助大不用 --no-cache docker build -f "apps/$APP/feishu/Dockerfile" \ -t "$FEISHU_IMAGE:${{ steps.tag.outputs.sha }}" \ "apps/$APP/feishu" docker push "$FEISHU_IMAGE:${{ steps.tag.outputs.sha }}" - name: Initialize K8s resources run: kubectl apply -f apps/notes/k8s/all.yaml - name: Roll out to k3s run: | kubectl -n "$NS" set image "deploy/$APP" \ "$APP=$IMAGE:${{ steps.tag.outputs.sha }}" \ "feishu=$FEISHU_IMAGE:${{ steps.tag.outputs.sha }}" kubectl -n "$NS" rollout status "deploy/$APP" --timeout=300s