From cdaa5415319980c855372580db9e3823edab0c67 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Tue, 13 May 2025 18:33:45 +0700 Subject: [PATCH] feat: chrome extension workflow --- .github/workflows/publish-extension.yml | 32 +++++++++++++++++++ apps/extension/manifest.json | 4 +-- apps/extension/package.json | 2 +- .../content/elements/action.component.tsx | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish-extension.yml diff --git a/.github/workflows/publish-extension.yml b/.github/workflows/publish-extension.yml new file mode 100644 index 00000000..f9b4e4e4 --- /dev/null +++ b/.github/workflows/publish-extension.yml @@ -0,0 +1,32 @@ +name: Publish Extension + +on: + workflow_dispatch: + +jobs: + submit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Zip extensions + run: FRONTEND_URL=https://platform.postiz.com pnpm run build:extension + + - name: Publish to Chrome Web Store + uses: mnao305/chrome-extension-upload@v5.0.0 + with: + extension-id: ${{ secrets.CHROME_EXTENSION_ID }} + client-id: ${{ secrets.CHROME_CLIENT_ID }} + client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} + refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} + file-path: apps/extension/extension.zip \ No newline at end of file diff --git a/apps/extension/manifest.json b/apps/extension/manifest.json index f4b844c9..132b2fbc 100755 --- a/apps/extension/manifest.json +++ b/apps/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Postiz", - "description": "Grow faster on socials", + "description": "Your ultimate social media scheduling tool", "options_ui": { "page": "src/pages/options/index.html" }, @@ -14,7 +14,7 @@ "icons": { "128": "icon-128.png" }, - "permissions": ["activeTab", "cookies", "tabs", "storage"], + "permissions": ["activeTab"], "content_scripts": [ { "matches": ["http://*/*", "https://*/*", ""], diff --git a/apps/extension/package.json b/apps/extension/package.json index 3ade2902..6e335360 100644 --- a/apps/extension/package.json +++ b/apps/extension/package.json @@ -1,6 +1,6 @@ { "name": "postiz-extension", - "version": "1.0.0", + "version": "1.0.1", "description": "A simple chrome & firefox extension template with Vite, React, TypeScript and Tailwind CSS.", "scripts": { "build": "rm -rf dist && vite build --config vite.config.chrome.ts && zip -r extension.zip dist", diff --git a/apps/extension/src/pages/content/elements/action.component.tsx b/apps/extension/src/pages/content/elements/action.component.tsx index 07025f28..5e0523ab 100644 --- a/apps/extension/src/pages/content/elements/action.component.tsx +++ b/apps/extension/src/pages/content/elements/action.component.tsx @@ -23,7 +23,7 @@ const Comp: FC<{ removeModal: () => void; platform: string, style: string }> = ( iframe.style.backgroundColor = 'transparent'; // @ts-ignore iframe.allowTransparency = 'true'; - iframe.src = import.meta.env.FRONTEND_URL + `/modal/${props.style}/${props.platform}`; + iframe.src = (import.meta.env?.FRONTEND_URL || process?.env?.FRONTEND_URL) + `/modal/${props.style}/${props.platform}`; iframe.id = 'modal-postiz'; iframe.style.width = '100%'; iframe.style.height = '100%';