From 56a365c6b4f35fb9eddf9fdba2e24a3a1ebb6a42 Mon Sep 17 00:00:00 2001 From: Mohamadzadeh <7796733@gmail.com> Date: Thu, 9 Jul 2026 13:34:48 +0330 Subject: [PATCH] auto build --- .gitea/workflows/build.yaml | 59 +++++++++++++++++++++++++++++++++++++ Dockerfile | 7 +++++ dist/remote-ui.d.ts | 8 +++++ dist/remote-ui.js | 43 +++++++++++++++++++++++++++ package.json | 3 +- 5 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/build.yaml create mode 100644 Dockerfile create mode 100644 dist/remote-ui.d.ts create mode 100644 dist/remote-ui.js diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..12a137a --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,59 @@ +name: Build and Deploy Next.js + Nginx Docker Image + +on: + push: + # branches: + # - main + +env: + REGISTRY: ${{ secrets.REGISTRY_URL }} + TAG: v${{ gitea.run_number }} + REPO: ${{ gitea.repository }} + IMAGE: ${{ secrets.REGISTRY_URL }}/${{ gitea.repository }}:v${{ gitea.run_number }} + +jobs: + build-and-deploy: + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + runs-on: ubuntu-latest + + steps: + - name: Checkout source + uses: https://git.d.aiengines.ir/actions/checkout@v4 + + - name: Set up Docker Buildx + uses: https://git.d.aiengines.ir/actions/setup-buildx-action@v3 + + - name: Log in to Docker registry + uses: https://git.d.aiengines.ir/actions/login-action@v3 + with: + registry: ${{ secrets.REGISTRY_URL }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and push Docker image + uses: https://git.d.aiengines.ir/actions/build-push-action@v6 + with: + context: . + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.REPO }}:latest + ${{ env.REGISTRY }}/${{ env.REPO }}:${{ env.TAG }} + cache-from: type=gha + cache-to: type=gha,mode=max + + deploy: + runs-on: ubuntu-latest + needs: build-and-deploy + + steps: + - name: deploy on server + uses: appleboy/ssh-action@v1 + env: + DRONE_SSH_RELEASE_URL: https://cdn.d.aiengines.ir/public/drone-ssh/releases + DRONE_SSH_VERSION: 1.8.1 + with: + host: 192.168.130.25 + username: bagher + key: ${{ secrets.SSH_KEY }} + script: | + docker service update -d --image ${{ env.IMAGE }} --force --with-registry-auth ${{ github.event.repository.name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..82ec91f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM docker.ibagher.ir/python:3.11-slim + +WORKDIR /app + +COPY ./dist ./dist + +CMD ["python3", "-m", "http.server", "--bind", "0.0.0.0", "8000", "--directory", "./dist/remote"] \ No newline at end of file diff --git a/dist/remote-ui.d.ts b/dist/remote-ui.d.ts new file mode 100644 index 0000000..e6afea7 --- /dev/null +++ b/dist/remote-ui.d.ts @@ -0,0 +1,8 @@ +import type { ComponentType, ReactNode } from "react"; + +export type GBadgeProps = { + children?: ReactNode; + [key: string]: unknown; +}; + +export declare const GBadge: ComponentType; diff --git a/dist/remote-ui.js b/dist/remote-ui.js new file mode 100644 index 0000000..42680ab --- /dev/null +++ b/dist/remote-ui.js @@ -0,0 +1,43 @@ +import { jsx as c } from "react/jsx-runtime"; +import { useRef as s, useEffect as i } from "react"; +const a = "https://uikit.d.aiengines.ir/remote/GBadge.js"; +let n = null; +function u() { + return n || (n = import( + /* webpackIgnore: true */ + /* @vite-ignore */ + a + )), n; +} +const m = (o) => { + const r = s(null); + return i(() => { + let e = !0; + return u().then((t) => { + e && r.current && t.mount(r.current, o); + }).catch((t) => { + console.error("[uikit/remote/ui] Failed to load GBadge:", t); + }), () => { + e = !1; + }; + }, [o]), i(() => { + const e = r.current; + return () => { + e && u().then((t) => { + t.unmount(e); + }).catch(() => { + }); + }; + }, []), /* @__PURE__ */ c( + "span", + { + ref: r, + style: { + display: "contents" + } + } + ); +}; +export { + m as GBadge +}; diff --git a/package.json b/package.json index 2a468cb..61dc9d4 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "dist" ], "scripts": { - "build": "vite build && yarn copy-types", + "build": "yarn build:lib && yarn build:remote && yarn copy-types", + "build:lib": "vite build", "build:remote": "vite build --mode remote", "copy-types": "yarn copy-index-types && yarn copy-utils-types && yarn copy-core-types && yarn copy-remote-ui-types", "copy-index-types": "cp src/index.d.ts dist/index.d.ts",