Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- fix: added release dev for shinkai-visor #46

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading