diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a50ba5..91a487f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,8 +40,13 @@ jobs: - name: Install dependencies run: pnpm install --no-frozen-lockfile + # Set EXTENSION_ENV variable to the current branch name + - name: Set EXTENSION_ENV variable + run: echo "EXTENSION_ENV=${GITHUB_REF##refs/heads/}" | sed 's/\//-/g' >> $GITHUB_ENV - name: Build artifacts run: pnpm build + env: + EXTENSION_ENV: ${{ env.EXTENSION_ENV }} - name: Upload extension artifacts uses: actions/upload-artifact@v4 diff --git a/apps/mocksi-lite-next/manifest.dev.json b/apps/mocksi-lite-next/manifest.dev.json index 8be1ad4..4343831 100755 --- a/apps/mocksi-lite-next/manifest.dev.json +++ b/apps/mocksi-lite-next/manifest.dev.json @@ -9,7 +9,7 @@ "externally_connectable": { "matches": ["http://localhost:3030/*"] }, - "name": "Mocksi Lite: Next (DEV)", + "name": "[Develpment] Mocksi Lite", "options_ui": { "page": "src/pages/options/index.html" } diff --git a/apps/mocksi-lite-next/manifest.json b/apps/mocksi-lite-next/manifest.json index 0c20ff2..ada20b3 100755 --- a/apps/mocksi-lite-next/manifest.json +++ b/apps/mocksi-lite-next/manifest.json @@ -15,18 +15,17 @@ } ], "content_security_policy": { - "extension_pages": "object-src 'none'; child-src https://nest-auth-ts-merge.onrender.com; frame-src https://nest-auth-ts-merge.onrender.com; script-src 'self'" + "extension_pages": "object-src 'none'; child-src https://app.mocksi.ai; frame-src https://app.mocksi.ai; script-src 'self'" }, "description": "https://www.mocksi.ai", "externally_connectable": { - "matches": ["https://nest-auth-ts-merge.onrender.com/*"] + "matches": ["https://app.mocksi.com/*"] }, "icons": { "128": "mocksi-logo.png" }, - "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtdeTUTUuHZx1xSvDuISF7wJP8nEPwW4vP8zTkdfdtb/1wM0JJ7XFeUHSIiq8l4Cs6/2f8tpK6MspeD7WhwuFWFHA2GWKoLSP0keuuBAhUFKrfISlNwFaNLX5LRkLSZQnr0ujIznvEuRZaXydIYR1e9pdhYTIcp2ToHW4CI02FUBtJVUUVeKGDiKKlKUrxwGtt1ecGZwVrQ1t7dj3DLrKguw1bONtoczFT3cCs9oVYg4l8frzlyI6xfsX8ynd4F+xS6+gYQ3aJBj7phAWHGAxbVRxTAzpzXRkb9A3ne31Ysjy4uYF9x7fK6NvDj/cm+EEfGDb3VmyXvOa3zeerXtdmwIDAQAB", "manifest_version": 3, - "name": "Mocksi Lite: Next", + "name": "Mocksi Lite", "permissions": [ "activeTab", "background", diff --git a/apps/mocksi-lite-next/manifest.staging.json b/apps/mocksi-lite-next/manifest.staging.json new file mode 100755 index 0000000..7c727ff --- /dev/null +++ b/apps/mocksi-lite-next/manifest.staging.json @@ -0,0 +1,48 @@ +{ + "action": { + "default_icon": { + "32": "mocksi-icon.png" + } + }, + "background": { + "service_worker": "src/pages/background/index.ts", + "type": "module" + }, + "content_scripts": [ + { + "js": ["src/pages/content/mocksi-extension.tsx"], + "matches": ["http://*/*", "https://*/*", ""] + } + ], + "content_security_policy": { + "extension_pages": "object-src 'none'; child-src https://nest-auth-ts-merge.onrender.com; frame-src https://nest-auth-ts-merge.onrender.com; script-src 'self'" + }, + "description": "https://www.mocksi.ai", + "externally_connectable": { + "matches": ["https://nest-auth-ts-merge.onrender.com/*"] + }, + "icons": { + "128": "mocksi-logo.png" + }, + "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtdeTUTUuHZx1xSvDuISF7wJP8nEPwW4vP8zTkdfdtb/1wM0JJ7XFeUHSIiq8l4Cs6/2f8tpK6MspeD7WhwuFWFHA2GWKoLSP0keuuBAhUFKrfISlNwFaNLX5LRkLSZQnr0ujIznvEuRZaXydIYR1e9pdhYTIcp2ToHW4CI02FUBtJVUUVeKGDiKKlKUrxwGtt1ecGZwVrQ1t7dj3DLrKguw1bONtoczFT3cCs9oVYg4l8frzlyI6xfsX8ynd4F+xS6+gYQ3aJBj7phAWHGAxbVRxTAzpzXRkb9A3ne31Ysjy4uYF9x7fK6NvDj/cm+EEfGDb3VmyXvOa3zeerXtdmwIDAQAB", + "manifest_version": 3, + "name": "[Staging] Mocksi Lite: Next", + "permissions": [ + "activeTab", + "background", + "cookies", + "downloads", + "debugger", + "scripting", + "storage", + "tabs", + "webNavigation", + "webRequest" + ], + "web_accessible_resources": [ + { + "matches": [], + "resources": ["mocksi-icon.png", "mocksi-logo.png"] + } + ] +} diff --git a/apps/mocksi-lite-next/vite.config.ts b/apps/mocksi-lite-next/vite.config.ts index 3d78057..f9fa9e7 100644 --- a/apps/mocksi-lite-next/vite.config.ts +++ b/apps/mocksi-lite-next/vite.config.ts @@ -4,6 +4,7 @@ import { resolve } from "path"; import { defineConfig } from "vite"; import devManifest from "./manifest.dev.json"; +import stagingManifest from "./manifest.staging.json"; import manifest from "./manifest.json"; import pkg from "./package.json"; @@ -15,10 +16,24 @@ const publicDir = resolve(__dirname, "public"); const isDev = process.env.__DEV__ === "true"; +const extensionENV = process.env.EXTENSION_ENV || "development"; +let activeManifest; + +switch (extensionENV) { + case "staging": + activeManifest = Object.assign(manifest, stagingManifest); + break; + case "production": + activeManifest = manifest; + break; + default: + activeManifest = Object.assign(manifest, devManifest); + break; +} + const extensionManifest = { - ...manifest, - ...(isDev ? devManifest : ({} as ManifestV3Export)), - name: isDev ? `DEV: ${manifest.name}` : manifest.name, + ...activeManifest, + name: activeManifest.name, version: pkg.version, };