name: Frontend CI on: push: branches: [main] paths: - 'frontend/**' - 'src/**' - 'build.sh' - '.gitea/workflows/frontend.yml' pull_request: branches: [main] paths: - 'frontend/**' - 'src/**' - 'build.sh' - '.gitea/workflows/frontend.yml' jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout code uses: https://github.com/actions/checkout@v4 - name: Lint JavaScript run: | for f in src/js/*.js; do if [ -f "$f" ]; then node --check "$f" 2>/dev/null || echo "⚠️ Syntax warning in $f" fi done - name: Lint CSS run: | for f in src/css/*.css; do if [ -f "$f" ]; then OPENING=$(grep -o '{' "$f" | wc -l) CLOSING=$(grep -o '}' "$f" | wc -l) if [ "$OPENING" -eq "$CLOSING" ]; then echo "✓ $f" else echo "⚠️ $f has unbalanced braces ($OPENING opening, $CLOSING closing)" fi fi done build: needs: lint runs-on: ubuntu-latest steps: - name: Checkout code uses: https://github.com/actions/checkout@v4 - name: Build standalone HTML run: | chmod +x build.sh ./build.sh - name: Rename artifact run: | mv standalone/index.html standalone/chat-switchboard.html ls -lh standalone/chat-switchboard.html - name: Create release package if: startsWith(github.ref, 'refs/tags/v') run: | zip -r chat-switchboard-web.zip standalone/ ls -lh chat-switchboard-web.zip - name: Upload to Gitea Packages if: startsWith(github.ref, 'refs/tags/v') run: | # Upload to Gitea package registry via API curl -X POST \ -H "Authorization: token ${{ secrets.ACTIONS_TOKEN }}" \ -H "Accept: application/json" \ -F "package_name=chat-switchboard-web" \ -F "package_version=${{ github.ref_name }}" \ -F "attachment=@chat-switchboard-web.zip" \ "https://git.gobha.me/api/packages/xcaliber/upload"