Skip to content

Commit

Permalink
- fix: added release dev for shinkai-visor (#46)
Browse files Browse the repository at this point in the history
* - fix: added release dev for shinkai-visor

* - fix: removed unused trigger
  • Loading branch information
agallardol authored Oct 13, 2023
1 parent 2323144 commit 76aa023
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 6 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release dev

on:
push:
branches: [ main ]

defaults:
run:
working-directory: ./

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use nx set shas
uses: nrwl/nx-set-shas@v3

- 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 --verbose
env:
VERSION: 0.0.0.${{github.run_number}}

- uses: actions/upload-artifact@v3
with:
name: shinkai-visor
path: dist/apps/shinkai-visor
if-no-files-found: error
retention-days: 5
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.tabSize": 2
"editor.tabSize": 2,
"json.schemas": [
{
"fileMatch": ["manifest.json"],
"url": "https://json.schemastore.org/chrome-manifest.json"
}
]
}
19 changes: 19 additions & 0 deletions apps/shinkai-visor/dynamic-manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineManifest } from '@crxjs/vite-plugin'

import baseManifestJson from './public/manifest.json';


const getVersion = () => {
const version = process.env.VERSION || baseManifestJson.version || '0.0.0.0';
const [major, minor, patch, label = '0'] = version
.replace(/[^\d.-]+/g, '')
.split(/[.-]/);
return `${major}.${minor}.${patch}.${label}`;
};

export const dynamicManifest = defineManifest((env) => {
return {
...baseManifestJson,
version: getVersion(),
};
});
14 changes: 9 additions & 5 deletions apps/shinkai-visor/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/// <reference types="vitest" />
import { crx,ManifestV3Export } from "@crxjs/vite-plugin";
import { crx } from "@crxjs/vite-plugin";
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from 'vite-plugin-wasm';

import manifestJson from './public/manifest.json';

const manifest = manifestJson as ManifestV3Export;
import { dynamicManifest } from './dynamic-manifest';

export default defineConfig({
cacheDir: '../../node_modules/.vite/shinkai-visor',
Expand All @@ -27,7 +25,13 @@ export default defineConfig({
host: 'localhost',
},

plugins: [react(), nxViteTsPaths(), wasm({ bundle: true }), topLevelAwait(), crx({ manifest })],
plugins: [
react(),
nxViteTsPaths(),
wasm({ bundle: true }),
topLevelAwait(),
crx({ manifest: dynamicManifest }),
],

test: {
globals: true,
Expand Down

0 comments on commit 76aa023

Please sign in to comment.