From 32b346c9712d7c838bc48011d16effd5d4f5ae0b Mon Sep 17 00:00:00 2001 From: Vlad Fedosov Date: Sat, 27 Apr 2024 11:07:47 -0400 Subject: [PATCH] fix(@lexical/devtools): Fixed publish pipeline (#5973) --- .github/workflows/devtools-extension-publish.yml | 12 ++++++++++-- packages/lexical-devtools/wxt.config.ts | 13 +++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/devtools-extension-publish.yml b/.github/workflows/devtools-extension-publish.yml index 0c1fbad33d4..92e27c2398e 100644 --- a/.github/workflows/devtools-extension-publish.yml +++ b/.github/workflows/devtools-extension-publish.yml @@ -2,6 +2,12 @@ name: Publish DevTools extension to stores on: workflow_dispatch: + inputs: + build_version: + description: 'Build version' + required: true + default: '0' + type: number jobs: release: @@ -17,15 +23,16 @@ jobs: cache: 'npm' - uses: actions/cache@v3 - id: cache + id: devtools-cache with: path: | node_modules + packages/lexical-devtools/.wxt ~/.cache/ms-playwright key: ${{ runner.os }}-${{ runner.arch }}v${{ secrets.CACHE_VERSION }}-${{ hashFiles('package-lock.json') }} - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' + if: steps.devtools-cache.outputs.cache-hit != 'true' run: npm ci - name: Zip & submit to stores @@ -38,3 +45,4 @@ jobs: FIREFOX_EXTENSION_ID: ${{ secrets.EXTENSION_FIREFOX_EXTENSION_ID }} FIREFOX_JWT_ISSUER: ${{ secrets.EXTENSION_FIREFOX_JWT_ISSUER }} FIREFOX_JWT_SECRET: ${{ secrets.EXTENSION_FIREFOX_JWT_SECRET }} + BUILD_VERSION: ${{ inputs.build_version }} diff --git a/packages/lexical-devtools/wxt.config.ts b/packages/lexical-devtools/wxt.config.ts index ff2f65e64b8..b3cf5988b81 100644 --- a/packages/lexical-devtools/wxt.config.ts +++ b/packages/lexical-devtools/wxt.config.ts @@ -7,6 +7,7 @@ */ import babel from '@rollup/plugin-babel'; import react from '@vitejs/plugin-react'; +import fs from 'fs'; import * as path from 'path'; import {defineConfig, UserManifest} from 'wxt'; @@ -19,6 +20,14 @@ export default defineConfig({ const browserName = configEnv.browser.charAt(0).toUpperCase() + configEnv.browser.slice(1); + let buildVersion = 0; // For dev purposes + if (process.env.BUILD_VERSION) { + buildVersion = parseInt(process.env.BUILD_VERSION, 10); + } + if (isNaN(buildVersion)) { + throw new Error('BUILD_VERSION must be a number'); + } + const manifestConf: UserManifest = { author: 'Lexical', description: `Adds Lexical debugging tools to the ${browserName} Developer Tools.`, @@ -31,6 +40,10 @@ export default defineConfig({ }, name: 'Lexical Developer Tools', permissions: ['scripting', 'storage', 'tabs'], + version: + JSON.parse( + fs.readFileSync(path.resolve(__dirname, 'package.json')).toString(), + ).version + `.${buildVersion}`, web_accessible_resources: [ { extension_ids: [],