Files
cube/.gitea/workflows/deploy-piano-sheet.yml
T
Fam Zheng 538bbb7ecd piano-sheet: ns cube-piano-sheet → cube-piano
ns 跟 app 名解耦,workflow 加 NS env 不再 cube-$APP 拼。
2026-05-05 10:03:38 +01:00

57 lines
1.6 KiB
YAML
Raw 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 piano-sheet
# piano.famzheng.me — 钢琴谱管理 / 阅读。host shell runnerfam 用户)。
on:
push:
branches: [master]
paths:
- 'apps/piano-sheet/**'
- 'crates/cube-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.gitea/workflows/deploy-piano-sheet.yml'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
APP: piano-sheet
NS: cube-piano
IMAGE: registry.famzheng.me/mochi/piano-sheet
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/piano-sheet/k8s/
- name: Roll out to k3s
run: |
kubectl -n "$NS" set image "deploy/$APP" "$APP=$IMAGE:${{ steps.tag.outputs.sha }}"
kubectl -n "$NS" rollout status "deploy/$APP" --timeout=120s