Skip to content

docs: update to Module Federation 2.0, remove all IIFE references #21

docs: update to Module Federation 2.0, remove all IIFE references

docs: update to Module Federation 2.0, remove all IIFE references #21

Workflow file for this run

# =============================================================================
# MODULE_DISPLAY_NAME - GitHub Actions CI/CD
# =============================================================================
# On push to main or a version tag:
# 1. Type-check frontend + run backend tests
# 2. Build the IIFE bundle (dist/nkz-module.js) — uploaded as artifact
# 3. Build and push the backend Docker image to GHCR (if module has a backend)
#
# After this workflow succeeds, manually upload dist/nkz-module.js to MinIO:
# mc cp nkz-module.js minio/nekazari-frontend/modules/MODULE_NAME/nkz-module.js \
# --attr "Content-Type=application/javascript"
# =============================================================================
name: Build and Push
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io
BACKEND_IMAGE: ghcr.io/${{ github.repository }}/MODULE_NAME-backend
jobs:
# ==========================================================================
# Test
# ==========================================================================
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install frontend dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
- name: Type check
run: npm run typecheck
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: backend/requirements.txt
- name: Install backend dependencies
run: pip install -r backend/requirements.txt
- name: Run backend tests
run: cd backend && python -m pytest tests/ -v
# ==========================================================================
# Build IIFE bundle
# ==========================================================================
# NOTE — DISABLED IN THE TEMPLATE.
# The template ships placeholder ids (`MODULE_NAME` etc.) that fail the
# nkzModulePreset's kebab-case validator. After you fork the template
# and replace placeholders, restore this job by removing the `if: false`.
build-module:
name: Build IIFE Bundle
runs-on: ubuntu-latest
needs: test
if: false
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
- name: Build module bundle
run: npm 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 and push backend Docker image
# ==========================================================================
# NOTE — DISABLED IN THE TEMPLATE for the same reason as above. Re-enable
# by removing `if: false` once placeholders are replaced.
build-backend:
name: Build Backend Image
runs-on: ubuntu-latest
needs: test
if: ${{ false && github.event_name != 'pull_request' }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Backend
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.BACKEND_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
- name: Build and push Backend image
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