diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml new file mode 100644 index 000000000..85db1e835 --- /dev/null +++ b/.github/workflows/release-prod.yml @@ -0,0 +1,61 @@ +name: Release production + +on: + # push: + # branches: + # - 'main' + # tags: + # - '[0-9]+.[0-9]+.[0-9]+' + push: + branches: + - 'agallardol/ci-production' + +defaults: + run: + working-directory: ./ + +jobs: + release-shinkai-visor: + runs-on: ubuntu-latest + environment: production + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node version + uses: actions/setup-node@v3 + with: + node-version: 18 + check-latest: false + registry-url: https://registry.npmjs.org + cache: 'npm' + cache-dependency-path: package-lock.json + + - name: Install dependencies + run: | + npm cache verify + npm ci --no-audit --prefer-offline + + - name: Run NX build on shinkai-visor + run: npx nx build shinkai-visor --skip-nx-cache + env: + # VERSION: ${{ github.ref }}.${{github.run_number}} + VERSION: 0.0.0.${{github.run_number}} + NAME_PREFIX: '' + DESCRIPTION_PREFIX: '' + PUBLIC_KEY: ${{ secrets.CHROME_EXTENSION_PUBLIC_KEY }} + + - name: Zip extension + run: cd ./dist/apps && zip -r shinkai-visor.zip shinkai-visor + + - name: Upload & Release + uses: mnao305/chrome-extension-upload@v4.0.1 + with: + file-path: dist/apps/shinkai-visor.zip + extension-id: ${{ secrets.CHROME_EXTENSION_ID }} + client-id: ${{ secrets.CHROME_CLIENT_ID }} + client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} + refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} + publish: false diff --git a/apps/shinkai-visor/dynamic-manifest.ts b/apps/shinkai-visor/dynamic-manifest.ts index 9ed226e58..f093009a9 100644 --- a/apps/shinkai-visor/dynamic-manifest.ts +++ b/apps/shinkai-visor/dynamic-manifest.ts @@ -20,12 +20,19 @@ const getDescription = () => { }`; }; +const getPublicKey = () => { + return ( + process.env.PUBLIC_KEY || + 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgdEOqEQpJXJIfmVTNW9NELXqA4yE2WoGo6C7ssQSW9oWiGugLRyUp1EeZ1xQSMaIN08yppKkn49QrTDo73/myuxP94LJ/vZN4rVuEYkzWUfKEv4bSABPkUkhNygddf22iXvfKpQkMzLnmXiKetS6k0NYDoz5GT8oVO2HxmQOgCJpX7wq6W0SzntqmUp5zN2FEh6rcZd20evL1HpxBA4ZylWmiS3n2pMfzCoR37YYaUlwE8Og+6RtuZIR3XaBKo7g3AG4vPi+TO5Jk4hjybYHtA38fBn6Gc5LEahywnJcoLTTSHEQ4hvylHgvlC9RpI8p121cRSmK2ycTuKpVBoRKMwIDAQAB' + ); +}; + export const dynamicManifest = defineManifest((env) => { return { ...baseManifestJson, version: getVersion(), name: getName(), description: getDescription(), - key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgdEOqEQpJXJIfmVTNW9NELXqA4yE2WoGo6C7ssQSW9oWiGugLRyUp1EeZ1xQSMaIN08yppKkn49QrTDo73/myuxP94LJ/vZN4rVuEYkzWUfKEv4bSABPkUkhNygddf22iXvfKpQkMzLnmXiKetS6k0NYDoz5GT8oVO2HxmQOgCJpX7wq6W0SzntqmUp5zN2FEh6rcZd20evL1HpxBA4ZylWmiS3n2pMfzCoR37YYaUlwE8Og+6RtuZIR3XaBKo7g3AG4vPi+TO5Jk4hjybYHtA38fBn6Gc5LEahywnJcoLTTSHEQ4hvylHgvlC9RpI8p121cRSmK2ycTuKpVBoRKMwIDAQAB', + key: getPublicKey(), }; });