@rimori/client 2.4.0-next.5 → 2.4.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/scripts/init/dev-registration.js +4 -2
- package/dist/cli/scripts/init/main.js +1 -0
- package/dist/controller/SettingsController.d.ts +1 -1
- package/dist/controller/SharedContentController.d.ts +1 -1
- package/dist/plugin/CommunicationHandler.d.ts +3 -1
- package/dist/plugin/CommunicationHandler.js +15 -13
- package/dist/plugin/StandaloneClient.d.ts +1 -1
- package/dist/plugin/StandaloneClient.js +3 -2
- package/dist/plugin/module/DbModule.d.ts +4 -4
- package/dist/plugin/module/EventModule.d.ts +1 -1
- package/dist/plugin/module/EventModule.js +1 -1
- package/dist/plugin/module/ExerciseModule.d.ts +1 -1
- package/dist/plugin/module/PluginModule.d.ts +1 -1
- package/package.json +8 -3
- package/.github/workflows/create-release-branch.yml +0 -226
- package/.github/workflows/pre-release.yml +0 -126
- package/.github/workflows/release-on-merge.yml +0 -195
- package/.prettierignore +0 -35
- package/eslint.config.js +0 -53
- package/example/docs/devdocs.md +0 -241
- package/example/docs/overview.md +0 -29
- package/example/docs/userdocs.md +0 -126
- package/example/rimori.config.ts +0 -91
- package/example/worker/vite.config.ts +0 -26
- package/example/worker/worker.ts +0 -11
- package/prettier.config.js +0 -8
- package/src/cli/scripts/init/dev-registration.ts +0 -189
- package/src/cli/scripts/init/env-setup.ts +0 -44
- package/src/cli/scripts/init/file-operations.ts +0 -58
- package/src/cli/scripts/init/html-cleaner.ts +0 -45
- package/src/cli/scripts/init/main.ts +0 -175
- package/src/cli/scripts/init/package-setup.ts +0 -113
- package/src/cli/scripts/init/router-transformer.ts +0 -332
- package/src/cli/scripts/init/tailwind-config.ts +0 -66
- package/src/cli/scripts/init/vite-config.ts +0 -73
- package/src/cli/scripts/release/detect-translation-languages.ts +0 -37
- package/src/cli/scripts/release/release-config-upload.ts +0 -119
- package/src/cli/scripts/release/release-db-update.ts +0 -97
- package/src/cli/scripts/release/release-file-upload.ts +0 -138
- package/src/cli/scripts/release/release.ts +0 -85
- package/src/cli/types/DatabaseTypes.ts +0 -125
- package/src/controller/AIController.ts +0 -295
- package/src/controller/AccomplishmentController.ts +0 -188
- package/src/controller/AudioController.ts +0 -64
- package/src/controller/ObjectController.ts +0 -120
- package/src/controller/SettingsController.ts +0 -186
- package/src/controller/SharedContentController.ts +0 -365
- package/src/controller/TranslationController.ts +0 -136
- package/src/controller/VoiceController.ts +0 -33
- package/src/fromRimori/EventBus.ts +0 -382
- package/src/fromRimori/PluginTypes.ts +0 -214
- package/src/fromRimori/readme.md +0 -2
- package/src/index.ts +0 -19
- package/src/plugin/CommunicationHandler.ts +0 -287
- package/src/plugin/Logger.ts +0 -394
- package/src/plugin/RimoriClient.ts +0 -199
- package/src/plugin/StandaloneClient.ts +0 -125
- package/src/plugin/module/AIModule.ts +0 -77
- package/src/plugin/module/DbModule.ts +0 -66
- package/src/plugin/module/EventModule.ts +0 -192
- package/src/plugin/module/ExerciseModule.ts +0 -131
- package/src/plugin/module/PluginModule.ts +0 -114
- package/src/utils/difficultyConverter.ts +0 -15
- package/src/utils/endpoint.ts +0 -3
- package/src/worker/WorkerSetup.ts +0 -35
- package/tsconfig.json +0 -17
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { createClient } from '@supabase/supabase-js';
|
|
10
|
+
// import { createClient } from '@supabase/supabase-js';
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import * as readline from 'readline';
|
|
13
13
|
import { DEFAULT_ANON_KEY, DEFAULT_ENDPOINT } from '../../../utils/endpoint.js';
|
|
@@ -112,7 +112,9 @@ export function authenticateWithSupabase(_a) {
|
|
|
112
112
|
// Initialize Supabase client (you may need to adjust the URL and key)
|
|
113
113
|
const supabaseUrl = process.env.SUPABASE_URL || DEFAULT_ENDPOINT;
|
|
114
114
|
const supabaseKey = process.env.SUPABASE_ANON_KEY || DEFAULT_ANON_KEY;
|
|
115
|
-
|
|
115
|
+
throw new Error('Authentication is disabled until new developer platform is released.');
|
|
116
|
+
// const supabase = createClient(supabaseUrl, supabaseKey);
|
|
117
|
+
const supabase = {};
|
|
116
118
|
try {
|
|
117
119
|
const { data, error } = yield supabase.auth.signInWithPassword({
|
|
118
120
|
email,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupabaseClient } from '
|
|
1
|
+
import { SupabaseClient } from '../plugin/CommunicationHandler';
|
|
2
2
|
import { RimoriClient } from '../plugin/RimoriClient';
|
|
3
3
|
import { ObjectRequest } from './ObjectController';
|
|
4
4
|
export interface SharedContentObjectRequest extends ObjectRequest {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
1
|
import { UserInfo } from '../controller/SettingsController';
|
|
3
2
|
import { ActivePlugin, Plugin } from '../fromRimori/PluginTypes';
|
|
3
|
+
import { PostgrestClient } from '@supabase/postgrest-js';
|
|
4
|
+
export type SupabaseClient = PostgrestClient;
|
|
4
5
|
export interface Guild {
|
|
5
6
|
allowUserPluginSettings: boolean;
|
|
6
7
|
city: string | null;
|
|
@@ -53,6 +54,7 @@ export declare class RimoriCommunicationHandler {
|
|
|
53
54
|
private sendHello;
|
|
54
55
|
private sendFinishedInit;
|
|
55
56
|
getQueryParam(key: string): string | null;
|
|
57
|
+
private getSupabase;
|
|
56
58
|
getClient(): Promise<{
|
|
57
59
|
supabase: SupabaseClient;
|
|
58
60
|
info: RimoriInfo;
|
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { createClient } from '@supabase/supabase-js';
|
|
11
10
|
import { EventBus } from '../fromRimori/EventBus';
|
|
11
|
+
import { PostgrestClient } from '@supabase/postgrest-js';
|
|
12
12
|
export class RimoriCommunicationHandler {
|
|
13
13
|
constructor(pluginId, standalone) {
|
|
14
14
|
this.port = null;
|
|
@@ -45,9 +45,7 @@ export class RimoriCommunicationHandler {
|
|
|
45
45
|
// Initialize Supabase client immediately with provided info
|
|
46
46
|
if (rimoriInfo) {
|
|
47
47
|
this.rimoriInfo = rimoriInfo;
|
|
48
|
-
this.supabase =
|
|
49
|
-
accessToken: () => Promise.resolve(rimoriInfo.token),
|
|
50
|
-
});
|
|
48
|
+
this.supabase = this.getSupabase(rimoriInfo.url, rimoriInfo.key, rimoriInfo.token);
|
|
51
49
|
}
|
|
52
50
|
// Handle messages from parent
|
|
53
51
|
this.port.onmessage = ({ data }) => {
|
|
@@ -133,6 +131,16 @@ export class RimoriCommunicationHandler {
|
|
|
133
131
|
getQueryParam(key) {
|
|
134
132
|
return this.queryParams[key] || null;
|
|
135
133
|
}
|
|
134
|
+
getSupabase(url, key, token) {
|
|
135
|
+
var _a;
|
|
136
|
+
return new PostgrestClient(`${url}/rest/v1`, {
|
|
137
|
+
schema: (_a = this.rimoriInfo) === null || _a === void 0 ? void 0 : _a.dbSchema,
|
|
138
|
+
headers: {
|
|
139
|
+
apikey: key,
|
|
140
|
+
Authorization: `Bearer ${token}`,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
136
144
|
getClient() {
|
|
137
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
146
|
// Return cached client if valid
|
|
@@ -174,9 +182,7 @@ export class RimoriCommunicationHandler {
|
|
|
174
182
|
var _a, _b;
|
|
175
183
|
if (((_a = event.data) === null || _a === void 0 ? void 0 : _a.topic) === 'global.supabase.requestAccess' && ((_b = event.data) === null || _b === void 0 ? void 0 : _b.eventId) === eventId) {
|
|
176
184
|
this.rimoriInfo = event.data.data;
|
|
177
|
-
this.supabase =
|
|
178
|
-
accessToken: () => Promise.resolve(this.rimoriInfo.token),
|
|
179
|
-
});
|
|
185
|
+
this.supabase = this.getSupabase(this.rimoriInfo.url, this.rimoriInfo.key, this.rimoriInfo.token);
|
|
180
186
|
self.onmessage = originalOnMessage; // Restore original handler
|
|
181
187
|
resolve({ supabase: this.supabase, info: this.rimoriInfo });
|
|
182
188
|
}
|
|
@@ -193,9 +199,7 @@ export class RimoriCommunicationHandler {
|
|
|
193
199
|
const { data } = yield EventBus.request(this.pluginId, 'global.supabase.requestAccess');
|
|
194
200
|
// console.log({ data });
|
|
195
201
|
this.rimoriInfo = data;
|
|
196
|
-
this.supabase =
|
|
197
|
-
accessToken: () => Promise.resolve(this.rimoriInfo.token),
|
|
198
|
-
});
|
|
202
|
+
this.supabase = this.getSupabase(this.rimoriInfo.url, this.rimoriInfo.key, this.rimoriInfo.token);
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
205
|
return { supabase: this.supabase, info: this.rimoriInfo };
|
|
@@ -209,9 +213,7 @@ export class RimoriCommunicationHandler {
|
|
|
209
213
|
// Update cached rimoriInfo
|
|
210
214
|
this.rimoriInfo = newInfo;
|
|
211
215
|
// Update Supabase client with new token
|
|
212
|
-
this.supabase =
|
|
213
|
-
accessToken: () => Promise.resolve(newInfo.token),
|
|
214
|
-
});
|
|
216
|
+
this.supabase = this.getSupabase(newInfo.url, newInfo.key, newInfo.token);
|
|
215
217
|
// Notify all registered callbacks
|
|
216
218
|
this.updateCallbacks.forEach((callback) => {
|
|
217
219
|
try {
|
|
@@ -7,12 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { createClient } from '@supabase/supabase-js';
|
|
11
10
|
import { EventBus } from '../fromRimori/EventBus';
|
|
12
11
|
import { DEFAULT_ANON_KEY, DEFAULT_ENDPOINT } from '../utils/endpoint';
|
|
13
12
|
export class StandaloneClient {
|
|
14
13
|
constructor(config) {
|
|
15
|
-
|
|
14
|
+
throw new Error('Authentication is disabled until new developer platform is released.');
|
|
15
|
+
// this.supabase = createClient(config.url, config.key);
|
|
16
|
+
this.supabase = {};
|
|
16
17
|
this.config = config;
|
|
17
18
|
}
|
|
18
19
|
static getInstance() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PostgrestQueryBuilder } from '@supabase/postgrest-js';
|
|
2
|
-
import { SupabaseClient } from '
|
|
3
|
-
import { GenericSchema } from '@supabase/supabase-js/dist/module/lib/types';
|
|
1
|
+
import { PostgrestClientOptions, PostgrestQueryBuilder } from '@supabase/postgrest-js';
|
|
2
|
+
import { SupabaseClient } from '../CommunicationHandler';
|
|
4
3
|
import { RimoriCommunicationHandler, RimoriInfo } from '../CommunicationHandler';
|
|
4
|
+
import { GenericSchema, GenericTable } from '@supabase/postgrest-js/dist/cjs/types/common/common';
|
|
5
5
|
/**
|
|
6
6
|
* Database module for plugin database operations.
|
|
7
7
|
* Provides access to plugin tables with automatic prefixing and schema management.
|
|
@@ -19,7 +19,7 @@ export declare class DbModule {
|
|
|
19
19
|
* @param relation The table name (without prefix for plugin tables, with 'global_' for global tables).
|
|
20
20
|
* @returns A Postgrest query builder for the table.
|
|
21
21
|
*/
|
|
22
|
-
from<ViewName extends string & keyof GenericSchema['Views'], View extends GenericSchema['Views'][ViewName]>(relation: string): PostgrestQueryBuilder<GenericSchema,
|
|
22
|
+
from<ViewName extends string & keyof GenericSchema['Views'], View extends GenericSchema['Views'][ViewName]>(relation: string): PostgrestQueryBuilder<PostgrestClientOptions, GenericSchema, GenericTable, ViewName, View>;
|
|
23
23
|
/**
|
|
24
24
|
* Get the table name for a given plugin table.
|
|
25
25
|
* Internally all tables are prefixed with the plugin id. This function is used to get the correct table name for a given public table.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventBusMessage, EventHandler, EventPayload, EventListener } from '../../fromRimori/EventBus';
|
|
2
1
|
import { MainPanelAction } from '../../fromRimori/PluginTypes';
|
|
3
2
|
import { AccomplishmentPayload } from '../../controller/AccomplishmentController';
|
|
3
|
+
import { EventBusMessage, EventHandler, EventPayload, EventListener } from '../../fromRimori/EventBus';
|
|
4
4
|
/**
|
|
5
5
|
* Event module for plugin event bus operations.
|
|
6
6
|
* Provides methods for emitting, listening to, and responding to events.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventBus } from '../../fromRimori/EventBus';
|
|
2
1
|
import { AccomplishmentController } from '../../controller/AccomplishmentController';
|
|
2
|
+
import { EventBus } from '../../fromRimori/EventBus';
|
|
3
3
|
/**
|
|
4
4
|
* Event module for plugin event bus operations.
|
|
5
5
|
* Provides methods for emitting, listening to, and responding to events.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupabaseClient } from '
|
|
1
|
+
import { SupabaseClient } from '../CommunicationHandler';
|
|
2
2
|
import { RimoriCommunicationHandler, RimoriInfo } from '../CommunicationHandler';
|
|
3
3
|
import { EventModule } from './EventModule';
|
|
4
4
|
export type TriggerAction = {
|
|
@@ -2,7 +2,7 @@ import { UserInfo } from '../../controller/SettingsController';
|
|
|
2
2
|
import { RimoriCommunicationHandler, RimoriInfo } from '../CommunicationHandler';
|
|
3
3
|
import { Translator } from '../../controller/TranslationController';
|
|
4
4
|
import { ActivePlugin, Plugin } from '../../fromRimori/PluginTypes';
|
|
5
|
-
import { SupabaseClient } from '
|
|
5
|
+
import { SupabaseClient } from '../CommunicationHandler';
|
|
6
6
|
type Theme = 'light' | 'dark';
|
|
7
7
|
type ApplicationMode = 'main' | 'sidebar' | 'settings';
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimori/client",
|
|
3
|
-
"version": "2.4.0-next.
|
|
3
|
+
"version": "2.4.0-next.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/rimori-org/rimori-client.git"
|
|
9
9
|
},
|
|
10
|
-
"license": "
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
11
|
"bin": {
|
|
12
12
|
"rimori-release": "./dist/cli/scripts/release/release.js",
|
|
13
13
|
"rimori-init": "./dist/cli/scripts/init/main.js"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
16
20
|
"exports": {
|
|
17
21
|
".": {
|
|
18
22
|
"types": "./dist/index.d.ts",
|
|
@@ -27,12 +31,13 @@
|
|
|
27
31
|
"format": "prettier --write ."
|
|
28
32
|
},
|
|
29
33
|
"dependencies": {
|
|
30
|
-
"@supabase/
|
|
34
|
+
"@supabase/postgrest-js": "^2.87.1",
|
|
31
35
|
"dotenv": "16.5.0",
|
|
32
36
|
"i18next": "^25.6.0"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
39
|
"@eslint/js": "^9.37.0",
|
|
40
|
+
"@types/node": "^25.0.1",
|
|
36
41
|
"eslint-config-prettier": "^10.1.8",
|
|
37
42
|
"eslint-plugin-prettier": "^5.5.4",
|
|
38
43
|
"eslint-plugin-react-hooks": "^7.0.0",
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
name: Create Release Branch
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
inputs:
|
|
6
|
-
base_branch:
|
|
7
|
-
description: 'Base branch to create release from'
|
|
8
|
-
required: true
|
|
9
|
-
default: 'main'
|
|
10
|
-
type: string
|
|
11
|
-
|
|
12
|
-
env:
|
|
13
|
-
SLACK_CHANNEL_ID: C09FDPQ8XPB
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
create-release-branch:
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
permissions:
|
|
19
|
-
contents: write
|
|
20
|
-
pull-requests: write
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- name: Checkout repository
|
|
24
|
-
uses: actions/checkout@v4
|
|
25
|
-
with:
|
|
26
|
-
fetch-depth: 0
|
|
27
|
-
token: ${{ secrets.PAT_TOKEN }}
|
|
28
|
-
|
|
29
|
-
- name: Setup Node.js
|
|
30
|
-
uses: actions/setup-node@v4
|
|
31
|
-
with:
|
|
32
|
-
node-version: '20'
|
|
33
|
-
cache: 'yarn'
|
|
34
|
-
|
|
35
|
-
- name: Checkout base branch
|
|
36
|
-
run: |
|
|
37
|
-
BASE_BRANCH="${{ inputs.base_branch }}"
|
|
38
|
-
git checkout $BASE_BRANCH
|
|
39
|
-
git pull origin $BASE_BRANCH
|
|
40
|
-
|
|
41
|
-
- name: Get current version
|
|
42
|
-
id: get_version
|
|
43
|
-
run: |
|
|
44
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
45
|
-
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
46
|
-
echo "Current version: $CURRENT_VERSION"
|
|
47
|
-
|
|
48
|
-
- name: Bump minor version
|
|
49
|
-
id: bump_version
|
|
50
|
-
run: |
|
|
51
|
-
CURRENT_VERSION="${{ steps.get_version.outputs.current_version }}"
|
|
52
|
-
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
|
|
53
|
-
MAJOR=${VERSION_PARTS[0]}
|
|
54
|
-
MINOR=${VERSION_PARTS[1]}
|
|
55
|
-
PATCH=${VERSION_PARTS[2]}
|
|
56
|
-
|
|
57
|
-
NEW_MINOR=$((MINOR + 1))
|
|
58
|
-
NEW_VERSION="$MAJOR.$NEW_MINOR.0"
|
|
59
|
-
|
|
60
|
-
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
61
|
-
echo "Bumping version from $CURRENT_VERSION to $NEW_VERSION"
|
|
62
|
-
|
|
63
|
-
- name: Get git commit messages
|
|
64
|
-
id: get_commits
|
|
65
|
-
run: |
|
|
66
|
-
BASE_BRANCH="${{ inputs.base_branch }}"
|
|
67
|
-
# Get commits since last tag, or last 20 commits if no tag exists
|
|
68
|
-
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
69
|
-
if [ -z "$LAST_TAG" ]; then
|
|
70
|
-
COMMITS=$(git log $BASE_BRANCH --pretty=format:"- %s (%h)" --no-merges | head -20)
|
|
71
|
-
else
|
|
72
|
-
COMMITS=$(git log $LAST_TAG..$BASE_BRANCH --pretty=format:"- %s (%h)" --no-merges)
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
if [ -z "$COMMITS" ]; then
|
|
76
|
-
COMMITS="- No commits found"
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
echo "commits<<EOF" >> $GITHUB_OUTPUT
|
|
80
|
-
echo "$COMMITS" >> $GITHUB_OUTPUT
|
|
81
|
-
echo "EOF" >> $GITHUB_OUTPUT
|
|
82
|
-
|
|
83
|
-
- name: Create release branch
|
|
84
|
-
run: |
|
|
85
|
-
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
86
|
-
BRANCH_NAME="release/v$NEW_VERSION"
|
|
87
|
-
git checkout -b $BRANCH_NAME
|
|
88
|
-
echo "Created branch: $BRANCH_NAME"
|
|
89
|
-
|
|
90
|
-
- name: Update package.json version
|
|
91
|
-
run: |
|
|
92
|
-
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
93
|
-
# Use node to update package.json to preserve formatting
|
|
94
|
-
node -e "const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); pkg.version = '$NEW_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
|
|
95
|
-
|
|
96
|
-
- name: Commit version bump
|
|
97
|
-
run: |
|
|
98
|
-
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
99
|
-
git config user.name "github-actions[bot]"
|
|
100
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
101
|
-
git add package.json
|
|
102
|
-
git commit -m "chore: bump version to $NEW_VERSION"
|
|
103
|
-
|
|
104
|
-
- name: Push release branch
|
|
105
|
-
run: |
|
|
106
|
-
BRANCH_NAME="release/v${{ steps.bump_version.outputs.new_version }}"
|
|
107
|
-
git push origin $BRANCH_NAME
|
|
108
|
-
|
|
109
|
-
- name: Create Pull Request
|
|
110
|
-
id: create_pr
|
|
111
|
-
env:
|
|
112
|
-
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
|
|
113
|
-
run: |
|
|
114
|
-
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
115
|
-
BRANCH_NAME="release/v$NEW_VERSION"
|
|
116
|
-
BASE_BRANCH="${{ inputs.base_branch }}"
|
|
117
|
-
COMMITS="${{ steps.get_commits.outputs.commits }}"
|
|
118
|
-
|
|
119
|
-
PR_BODY="## Release v${NEW_VERSION}
|
|
120
|
-
|
|
121
|
-
This PR bumps the version to **v${NEW_VERSION}**.
|
|
122
|
-
|
|
123
|
-
### Recent Changes
|
|
124
|
-
|
|
125
|
-
${COMMITS}
|
|
126
|
-
|
|
127
|
-
### Next Steps
|
|
128
|
-
- Review and merge this PR
|
|
129
|
-
- The release workflow will automatically create a prerelease when merged to main"
|
|
130
|
-
|
|
131
|
-
PR_URL=$(gh pr create \
|
|
132
|
-
--base "$BASE_BRANCH" \
|
|
133
|
-
--head "$BRANCH_NAME" \
|
|
134
|
-
--title "Release v$NEW_VERSION" \
|
|
135
|
-
--body "$PR_BODY")
|
|
136
|
-
|
|
137
|
-
PR_NUMBER=$(echo "$PR_URL" | grep -o '[0-9]*$')
|
|
138
|
-
echo "pull-request-number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
|
139
|
-
echo "pull-request-url=$PR_URL" >> $GITHUB_OUTPUT
|
|
140
|
-
echo "Created PR: $PR_URL"
|
|
141
|
-
|
|
142
|
-
- name: Send Slack notification - Success
|
|
143
|
-
if: success()
|
|
144
|
-
uses: slackapi/slack-github-action@v1.24.0
|
|
145
|
-
with:
|
|
146
|
-
channel-id: ${{ env.SLACK_CHANNEL_ID }}
|
|
147
|
-
payload: |
|
|
148
|
-
{
|
|
149
|
-
"text": "✅ Rimori-Client Release Branch Created",
|
|
150
|
-
"blocks": [
|
|
151
|
-
{
|
|
152
|
-
"type": "header",
|
|
153
|
-
"text": {
|
|
154
|
-
"type": "plain_text",
|
|
155
|
-
"text": "✅ rimori-client Release Branch Created"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"type": "section",
|
|
160
|
-
"fields": [
|
|
161
|
-
{
|
|
162
|
-
"type": "mrkdwn",
|
|
163
|
-
"text": "*Version:*\nv${{ steps.bump_version.outputs.new_version }}"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"type": "mrkdwn",
|
|
167
|
-
"text": "*Branch:*\n`release/v${{ steps.bump_version.outputs.new_version }}`"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"type": "mrkdwn",
|
|
171
|
-
"text": "*PR:*\n#${{ steps.create_pr.outputs.pull-request-number }}"
|
|
172
|
-
}
|
|
173
|
-
]
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"type": "section",
|
|
177
|
-
"text": {
|
|
178
|
-
"type": "mrkdwn",
|
|
179
|
-
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
env:
|
|
185
|
-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
186
|
-
|
|
187
|
-
- name: Send Slack notification - Failure
|
|
188
|
-
if: failure()
|
|
189
|
-
uses: slackapi/slack-github-action@v1.24.0
|
|
190
|
-
with:
|
|
191
|
-
channel-id: ${{ env.SLACK_CHANNEL_ID }}
|
|
192
|
-
payload: |
|
|
193
|
-
{
|
|
194
|
-
"text": "❌ rimori-client Release Branch Creation Failed",
|
|
195
|
-
"blocks": [
|
|
196
|
-
{
|
|
197
|
-
"type": "header",
|
|
198
|
-
"text": {
|
|
199
|
-
"type": "plain_text",
|
|
200
|
-
"text": "❌ rimori-client Release Branch Creation Failed"
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"type": "section",
|
|
205
|
-
"fields": [
|
|
206
|
-
{
|
|
207
|
-
"type": "mrkdwn",
|
|
208
|
-
"text": "*Version:*\nv${{ steps.bump_version.outputs.new_version }}"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"type": "mrkdwn",
|
|
212
|
-
"text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
|
|
213
|
-
}
|
|
214
|
-
]
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
"type": "section",
|
|
218
|
-
"text": {
|
|
219
|
-
"type": "mrkdwn",
|
|
220
|
-
"text": "⚠️ *Action Required:* Review the pipeline failures and fix the issues before retrying."
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
env:
|
|
226
|
-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
name: Pre-Release Rimori Client
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [dev]
|
|
6
|
-
paths:
|
|
7
|
-
- '**'
|
|
8
|
-
- '!.github/workflows/**'
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
pre-release:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
permissions:
|
|
14
|
-
contents: write
|
|
15
|
-
id-token: write
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- name: Checkout repository
|
|
19
|
-
uses: actions/checkout@v4
|
|
20
|
-
with:
|
|
21
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
-
fetch-depth: 0
|
|
23
|
-
|
|
24
|
-
- name: Setup Node.js
|
|
25
|
-
uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: '20'
|
|
28
|
-
registry-url: 'https://registry.npmjs.org'
|
|
29
|
-
cache: 'yarn'
|
|
30
|
-
cache-dependency-path: yarn.lock
|
|
31
|
-
|
|
32
|
-
- name: Update npm
|
|
33
|
-
run: npm install -g npm@latest
|
|
34
|
-
|
|
35
|
-
- name: Install dependencies
|
|
36
|
-
run: yarn install --frozen-lockfile
|
|
37
|
-
|
|
38
|
-
- name: Build rimori-client (TypeScript verification)
|
|
39
|
-
run: yarn build
|
|
40
|
-
|
|
41
|
-
- name: Calculate next pre-release version
|
|
42
|
-
id: version
|
|
43
|
-
run: |
|
|
44
|
-
# Read current version from package.json (may be base or pre-release)
|
|
45
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
46
|
-
|
|
47
|
-
# Extract base version (strip any pre-release suffix)
|
|
48
|
-
# Examples: "2.2.0" -> "2.2.0", "2.2.0-next.5" -> "2.2.0"
|
|
49
|
-
if [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]]; then
|
|
50
|
-
BASE_VERSION="${BASH_REMATCH[1]}"
|
|
51
|
-
else
|
|
52
|
-
BASE_VERSION="$CURRENT_VERSION"
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
# Try to get latest next version from npm
|
|
56
|
-
LATEST_NEXT=$(npm view @rimori/client@next version 2>/dev/null || echo "none")
|
|
57
|
-
|
|
58
|
-
if [ "$LATEST_NEXT" != "none" ]; then
|
|
59
|
-
# Extract base version and pre-release number from latest next version
|
|
60
|
-
# Example: "2.2.0-next.5" -> extract "2.2.0" and "5"
|
|
61
|
-
if [[ "$LATEST_NEXT" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-next\.([0-9]+)$ ]]; then
|
|
62
|
-
LATEST_BASE="${BASH_REMATCH[1]}"
|
|
63
|
-
PRERELEASE_NUM="${BASH_REMATCH[2]}"
|
|
64
|
-
|
|
65
|
-
# If base version changed, reset to 1, otherwise increment
|
|
66
|
-
if [ "$LATEST_BASE" != "$BASE_VERSION" ]; then
|
|
67
|
-
NEW_NUM=1
|
|
68
|
-
else
|
|
69
|
-
NEW_NUM=$((PRERELEASE_NUM + 1))
|
|
70
|
-
fi
|
|
71
|
-
else
|
|
72
|
-
# Fallback: if format doesn't match, start at 1
|
|
73
|
-
NEW_NUM=1
|
|
74
|
-
fi
|
|
75
|
-
else
|
|
76
|
-
# First pre-release
|
|
77
|
-
NEW_NUM=1
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
NEW_VERSION="${BASE_VERSION}-next.${NEW_NUM}"
|
|
81
|
-
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
82
|
-
echo "Base version: $BASE_VERSION"
|
|
83
|
-
echo "Calculated next version: $NEW_VERSION"
|
|
84
|
-
|
|
85
|
-
- name: Update package.json version
|
|
86
|
-
run: |
|
|
87
|
-
# Use node to update version directly (yarn version creates git tags)
|
|
88
|
-
node -e "const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('package.json')); pkg.version = '${{ steps.version.outputs.new_version }}'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
|
|
89
|
-
|
|
90
|
-
- name: Publish to npm
|
|
91
|
-
run: npm publish --tag next --access public
|
|
92
|
-
# Uses OIDC token automatically (no NODE_AUTH_TOKEN needed)
|
|
93
|
-
# Requires npm 11.5.1+ and id-token: write permission (already set)
|
|
94
|
-
|
|
95
|
-
- name: Output published version
|
|
96
|
-
run: |
|
|
97
|
-
echo "✅ Published @rimori/client@${{ steps.version.outputs.new_version }} to npm with @next tag"
|
|
98
|
-
|
|
99
|
-
- name: Create git tag
|
|
100
|
-
run: |
|
|
101
|
-
git config --local user.email "action@github.com"
|
|
102
|
-
git config --local user.name "GitHub Action"
|
|
103
|
-
git tag "v${{ steps.version.outputs.new_version }}" -m "Pre-release v${{ steps.version.outputs.new_version }}"
|
|
104
|
-
git push origin "v${{ steps.version.outputs.new_version }}"
|
|
105
|
-
echo "🏷️ Created and pushed tag v${{ steps.version.outputs.new_version }}"
|
|
106
|
-
|
|
107
|
-
- name: Notify Slack
|
|
108
|
-
if: always()
|
|
109
|
-
uses: slackapi/slack-github-action@v1.24.0
|
|
110
|
-
with:
|
|
111
|
-
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
|
|
112
|
-
payload: |
|
|
113
|
-
{
|
|
114
|
-
"text": "Pre-Release Pipeline Status",
|
|
115
|
-
"blocks": [
|
|
116
|
-
{
|
|
117
|
-
"type": "section",
|
|
118
|
-
"text": {
|
|
119
|
-
"type": "mrkdwn",
|
|
120
|
-
"text": "📦 *@rimori/client Pre-Release*\n\n*Branch:* ${{ github.ref_name }}\n*Version:* ${{ steps.version.outputs.new_version }}\n*Author:* ${{ github.actor }}\n*Pipeline:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>\n\n${{ job.status == 'success' && '✅ Successfully published to npm with @next tag!' || '❌ Pipeline failed. Check the logs for details.' }}"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
env:
|
|
126
|
-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|