fix(elevation): use redis-service hostname, make Redis failures non-fatal #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # EU Elevation Module — Build & Push | |
| # ============================================================================= | |
| # On push to main or version tag: | |
| # 1. Validate: frontend typecheck + backend import smoke test | |
| # 2. Build IIFE bundle → upload as artifact | |
| # 3. Build & push backend Docker image to GHCR | |
| # | |
| # After this succeeds, upload IIFE to MinIO: | |
| # mc cp dist/nkz-module.js minio/nekazari-frontend/modules/nkz-module-eu-elevation/nkz-module.js \ | |
| # --attr "Content-Type=application/javascript" | |
| # ============================================================================= | |
| name: Build and Push | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| BACKEND_IMAGE: ghcr.io/${{ github.repository }}/backend | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| # ========================================================================== | |
| # Validate | |
| # ========================================================================== | |
| validate: | |
| name: Validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Install frontend deps + typecheck | |
| run: | | |
| pnpm install --frozen-lockfile | |
| pnpm run typecheck | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: backend/requirements.txt | |
| - name: Backend smoke test | |
| run: | | |
| pip install -r backend/requirements.txt | |
| cd backend && python -c "from app.main import app; print('app import ok')" | |
| # ========================================================================== | |
| # Build IIFE Bundle | |
| # ========================================================================== | |
| build-iife: | |
| name: Build IIFE Bundle | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build module bundle | |
| run: pnpm run build:module | |
| - name: Upload bundle artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nkz-module | |
| path: dist/nkz-module.js | |
| retention-days: 30 | |
| # ========================================================================== | |
| # Build & Push Backend Image | |
| # ========================================================================== | |
| build-backend: | |
| name: Build Backend Image | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.BACKEND_IMAGE }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,prefix=,format=short | |
| type=semver,pattern={{version}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| file: ./backend/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Summary | |
| run: | | |
| echo "## EU Elevation Backend Image" >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| echo "${{ steps.meta.outputs.tags }}" >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "After push, deploy to K8s:" >> "$GITHUB_STEP_SUMMARY" | |
| echo "\`kubectl rollout restart deployment/elevation-api elevation-worker -n nekazari\`" >> "$GITHUB_STEP_SUMMARY" |