Skip to content

Commit

Permalink
Merge branch 'main' into agallardol/npm-audit-schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Oct 30, 2023
2 parents 24e5a93 + 52175c7 commit 4ff2a69
Show file tree
Hide file tree
Showing 24 changed files with 307 additions and 99 deletions.
86 changes: 70 additions & 16 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Release dev

on:
push:
branches: [ main, agallardol/mobile-build ]
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
# push:
# branches: [main]

defaults:
run:
working-directory: ./

jobs:
release:
release-shinkai-visor:
runs-on: ubuntu-latest
environment: development
steps:
Expand All @@ -27,19 +30,34 @@ jobs:
node-version: 18
check-latest: false
registry-url: https://registry.npmjs.org
cache: "npm"
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: |
npm cache verify
npm ci --no-audit --prefer-offline
# shinkai-visor
- name: Run NX build on shinkai-visor
run: npx nx build shinkai-visor --skip-nx-cache --verbose
run: npx nx build shinkai-visor --skip-nx-cache
env:
VERSION: 0.0.0.${{github.run_number}}
NAME_PREFIX: '[Dev] '
DESCRIPTION_PREFIX: 'This is for development purpose.\n\n'

- name: Zip extension
run: cd ./dist/apps && zip -r shinkai-visor.zip shinkai-visor

- name: Upload & Release
uses: mnao305/[email protected]
continue-on-error: true
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

- uses: actions/upload-artifact@v3
with:
Expand All @@ -48,32 +66,68 @@ jobs:
if-no-files-found: error
retention-days: 5

# shinkai-app-android
release-shinkai-app-android:
runs-on: ubuntu-latest
environment: development
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
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Run NX build on shinkai-app-android
- name: Set mobile apps version
run: |
npx capacitor-set-version -v $VERSION -b $BUILD $APP_PATH
env:
VERSION: 0.0.0
BUILD: ${{github.run_number}}
BUILD: ${{ github.run_number }}
APP_PATH: ./apps/shinkai-app

- name: Mount shinkai android keystore from secret
run: |
echo $KEYSTORE_BASE_64_STRING > $KEYSTORE_BASE_64_FILE_NAME
base64 -d $KEYSTORE_BASE_64_FILE_NAME > $KEYSTORE_FILE_PATH
env:
KEYSTORE_BASE_64_STRING: ${{ secrets.ANDROID_KEYSTORE_BASE_64 }}
KEYSTORE_BASE_64_FILE_NAME: shinkai-keystore-android-upload-base-64
KEYSTORE_FILE_PATH: ./apps/shinkai-app/android/shinkai-keystore-android

- name: Run NX build on shinkai-app-android
run: |
npx nx build:android shinkai-app --verbose
npx nx build:android shinkai-app
env:
ANDROID_KEYSTORE_FILE_PATH: ${{ secrets.ANDROID_KEYSTORE_FILE_PATH }}
ANDROID_KEYSTORE_FILE_PATH: shinkai-keystore-android
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_ALIAS_PASS: ${{ secrets.ANDROID_KEYSTORE_ALIAS_PASS }}

- uses: actions/upload-artifact@v3
- name: Upload signed android .AAB file to Google Play Store
uses: r0adkll/upload-google-play@v1
with:
name: shinkai-app-android
path: dist/apps/shinkai-app-android
if-no-files-found: error
retention-days: 5
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: com.shinkai.app
releaseFiles: ./dist/apps/shinkai-app-android/app-release-signed.aab
track: internal
status: draft
6 changes: 3 additions & 3 deletions apps/shinkai-app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'

android {
namespace "io.dcspark.shinkai"
namespace "com.shinkai.app"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "io.dcspark.shinkai"
applicationId "com.shinkai.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
versionName "0.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.dcspark.shinkai;
package com.shinkai.app;

import com.getcapacitor.BridgeActivity;

Expand Down
8 changes: 4 additions & 4 deletions apps/shinkai-app/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">ShinkaiApp</string>
<string name="title_activity_main">ShinkaiApp</string>
<string name="package_name">io.dcspark.shinkai</string>
<string name="custom_url_scheme">io.dcspark.shinkai</string>
<string name="app_name">Shinkai</string>
<string name="title_activity_main">Shinkai</string>
<string name="package_name">com.shinkai.app</string>
<string name="custom_url_scheme">com.shinkai.app</string>
</resources>
8 changes: 5 additions & 3 deletions apps/shinkai-app/capacitor.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
appId: 'io.dcspark.shinkai',
appName: 'ShinkaiApp',
appId: 'com.shinkai.app',
appName: 'Shinkai',
webDir: '../../dist/apps/shinkai-app',
server: {
androidScheme: 'https'
androidScheme: 'https',
url: process.env.SERVE ? 'http://10.0.2.2:9000' : undefined,
cleartext: process.env.SERVE ? true : false,
}
};

Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-app/ionic.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ShinkaiApp",
"name": "Shinkai",
"integrations": {
"capacitor": {}
},
Expand Down
8 changes: 4 additions & 4 deletions apps/shinkai-app/ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.0.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = io.dcspark.shinkai;
PRODUCT_BUNDLE_IDENTIFIER = com.shinkai.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
Expand All @@ -370,8 +370,8 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.dcspark.shinkai;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.shinkai.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-app/ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ShinkaiApp</string>
<string>Shinkai</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
5 changes: 4 additions & 1 deletion apps/shinkai-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"private": true,
"version": "0.0.1",
"type": "module",
"description": "Shinkai Multiplatform App"
"description": "Shinkai Multiplatform App",
"scripts": {
"serve:android": "SERVE=true npx cap run android"
}
}
15 changes: 14 additions & 1 deletion apps/shinkai-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"executor": "@nx/vite:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "shinkai-app:build"
"buildTarget": "shinkai-app:build",
"port": 9000
},
"configurations": {
"development": {
Expand All @@ -70,6 +71,18 @@
}
}
},
"serve:android": {
"executor": "nx:run-script",
"defaultConfiguration": "development",
"options": {
"cwd": "apps/shinkai-app",
"script": "serve:android"
},
"configurations": {
"development": {},
"production": {}
}
},
"preview": {
"executor": "@nx/vite:preview-server",
"defaultConfiguration": "development",
Expand Down
2 changes: 1 addition & 1 deletion apps/shinkai-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({

server: {
port: 4200,
host: 'localhost',
host: true,
fs: {
// Important to server files two levels ahead of the project folder
allow: ['../../'],
Expand Down
12 changes: 11 additions & 1 deletion apps/shinkai-visor/dynamic-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ import baseManifestJson from './public/manifest.json';


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

const getName = () => {
return `${process.env.NAME_PREFIX || ''}${baseManifestJson.name}`;
}

const getDescription = () => {
return `${process.env.DESCRIPTION_PREFIX || ''}${baseManifestJson.description}`;
}

export const dynamicManifest = defineManifest((env) => {
return {
...baseManifestJson,
version: getVersion(),
name: getName(),
description: getDescription(),
};
});
Binary file modified apps/shinkai-visor/public/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/shinkai-visor/public/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/shinkai-visor/public/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions apps/shinkai-visor/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"description": "Transforms your web browser into a first class Shinkai client.",
"manifest_version": 3,
"update_url": "https://clients2.google.com/service/update2/crx",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm5XZIjmISeYdECai228Nz5DKO7nA3MN5FWwsg5kImRjAZcWbNBG4ywJhwo7UjUErljng5wrerJATFhcxlXYfkSGR6gfV3sk4j+twm0PxlQXge8w0e24S55j6lk2vNHA3AwfnI8/wl3kI1CqWK6YqtSL7lDWw5inVvz3JH9w4fvXPlQpBkU52BDEE6dQQ3npscdh05/aBmOiHGev+Q1D5NCbh7TJQaXDE30ApS4u6bwr1rQrSXjc2Hcy/8yiLvAmzLNOG6fAGMUIUdrMweqgmgKxKF1+v4i+fkNy4jZF2rLMZRqKzLrDF7Ov60TYt+hFC+IriOUVzemg7h4QQR+51ZQIDAQAB",
"version": "0.4.2",
"version": "0.0.0.1",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
Expand Down
1 change: 1 addition & 0 deletions apps/shinkai-visor/src/components/popup/popup-embeder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ iframe.setAttribute('src', chrome.runtime.getURL('src/components/popup/popup.htm
iframe.style.border = 'none';
iframe.style.width = '100%';
iframe.style.height = '100%';
iframe.style.colorScheme = 'only light';

const shadow = baseContainer.attachShadow({ mode: 'open' });
shadow.appendChild(iframe);
Expand Down
2 changes: 1 addition & 1 deletion libs/shinkai-message-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shinkai_network/shinkai-message-ts",
"version": "0.0.9",
"version": "0.0.11",
"description": "Shinkai Message TS wrapper for wasm library",
"type": "module",
"main": "src/index.js",
Expand Down
22 changes: 21 additions & 1 deletion libs/shinkai-message-ts/src/pkg/shinkai_message_wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,27 @@ export class ShinkaiMessageWrapper {
/**
* @returns {string}
*/
calculate_hash(): string;
calculate_blake3_hash(): string;
/**
* @returns {ShinkaiMessageWrapper}
*/
new_with_empty_outer_signature(): ShinkaiMessageWrapper;
/**
* @returns {ShinkaiMessageWrapper}
*/
new_with_empty_inner_signature(): ShinkaiMessageWrapper;
/**
* @returns {string}
*/
inner_content_for_hashing(): string;
/**
* @returns {string}
*/
calculate_blake3_hash_with_empty_outer_signature(): string;
/**
* @returns {string}
*/
calculate_blake3_hash_with_empty_inner_signature(): string;
/**
* @returns {string}
*/
Expand Down
Loading

0 comments on commit 4ff2a69

Please sign in to comment.