mirror of
https://github.com/immich-app/immich.git
synced 2025-04-17 21:46:25 +02:00
build: version pump script (#1398)
* build: version pump script * feat: server pump is optional * chore: remove unused variable * chore: examples Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
4e6880e520
commit
443d08381a
14 changed files with 88 additions and 49 deletions
mobile
lib/shared/providers
openapi
scripts
server
web/src/api/open-api
|
@ -13,7 +13,6 @@ class ServerInfoNotifier extends StateNotifier<ServerInfoState> {
|
||||||
major: 0,
|
major: 0,
|
||||||
patch_: 0,
|
patch_: 0,
|
||||||
minor: 0,
|
minor: 0,
|
||||||
build: 0,
|
|
||||||
),
|
),
|
||||||
isVersionMismatch: false,
|
isVersionMismatch: false,
|
||||||
versionMismatchErrorMessage: "",
|
versionMismatchErrorMessage: "",
|
||||||
|
|
2
mobile/openapi/doc/AssetApi.md
generated
2
mobile/openapi/doc/AssetApi.md
generated
|
@ -336,7 +336,7 @@ Name | Type | Description | Notes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Current this is not used in any UI element
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```dart
|
```dart
|
||||||
|
|
1
mobile/openapi/doc/ServerVersionReponseDto.md
generated
1
mobile/openapi/doc/ServerVersionReponseDto.md
generated
|
@ -11,7 +11,6 @@ Name | Type | Description | Notes
|
||||||
**major** | **int** | |
|
**major** | **int** | |
|
||||||
**minor** | **int** | |
|
**minor** | **int** | |
|
||||||
**patch_** | **int** | |
|
**patch_** | **int** | |
|
||||||
**build** | **int** | |
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
4
mobile/openapi/lib/api/asset_api.dart
generated
4
mobile/openapi/lib/api/asset_api.dart
generated
|
@ -347,7 +347,7 @@ class AssetApi {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Current this is not used in any UI element
|
||||||
///
|
///
|
||||||
/// Note: This method returns the HTTP [Response].
|
/// Note: This method returns the HTTP [Response].
|
||||||
///
|
///
|
||||||
|
@ -383,7 +383,7 @@ class AssetApi {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Current this is not used in any UI element
|
||||||
///
|
///
|
||||||
/// Parameters:
|
/// Parameters:
|
||||||
///
|
///
|
||||||
|
|
|
@ -16,7 +16,6 @@ class ServerVersionReponseDto {
|
||||||
required this.major,
|
required this.major,
|
||||||
required this.minor,
|
required this.minor,
|
||||||
required this.patch_,
|
required this.patch_,
|
||||||
required this.build,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
int major;
|
int major;
|
||||||
|
@ -25,32 +24,27 @@ class ServerVersionReponseDto {
|
||||||
|
|
||||||
int patch_;
|
int patch_;
|
||||||
|
|
||||||
int build;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => identical(this, other) || other is ServerVersionReponseDto &&
|
bool operator ==(Object other) => identical(this, other) || other is ServerVersionReponseDto &&
|
||||||
other.major == major &&
|
other.major == major &&
|
||||||
other.minor == minor &&
|
other.minor == minor &&
|
||||||
other.patch_ == patch_ &&
|
other.patch_ == patch_;
|
||||||
other.build == build;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
// ignore: unnecessary_parenthesis
|
// ignore: unnecessary_parenthesis
|
||||||
(major.hashCode) +
|
(major.hashCode) +
|
||||||
(minor.hashCode) +
|
(minor.hashCode) +
|
||||||
(patch_.hashCode) +
|
(patch_.hashCode);
|
||||||
(build.hashCode);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'ServerVersionReponseDto[major=$major, minor=$minor, patch_=$patch_, build=$build]';
|
String toString() => 'ServerVersionReponseDto[major=$major, minor=$minor, patch_=$patch_]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
json[r'major'] = this.major;
|
json[r'major'] = this.major;
|
||||||
json[r'minor'] = this.minor;
|
json[r'minor'] = this.minor;
|
||||||
json[r'patch'] = this.patch_;
|
json[r'patch'] = this.patch_;
|
||||||
json[r'build'] = this.build;
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +70,6 @@ class ServerVersionReponseDto {
|
||||||
major: mapValueOfType<int>(json, r'major')!,
|
major: mapValueOfType<int>(json, r'major')!,
|
||||||
minor: mapValueOfType<int>(json, r'minor')!,
|
minor: mapValueOfType<int>(json, r'minor')!,
|
||||||
patch_: mapValueOfType<int>(json, r'patch')!,
|
patch_: mapValueOfType<int>(json, r'patch')!,
|
||||||
build: mapValueOfType<int>(json, r'build')!,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -129,7 +122,6 @@ class ServerVersionReponseDto {
|
||||||
'major',
|
'major',
|
||||||
'minor',
|
'minor',
|
||||||
'patch',
|
'patch',
|
||||||
'build',
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
mobile/openapi/test/asset_api_test.dart
generated
2
mobile/openapi/test/asset_api_test.dart
generated
|
@ -59,7 +59,7 @@ void main() {
|
||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
// Current this is not used in any UI element
|
||||||
//
|
//
|
||||||
//Future<Object> downloadLibrary({ num skip }) async
|
//Future<Object> downloadLibrary({ num skip }) async
|
||||||
test('test downloadLibrary', () async {
|
test('test downloadLibrary', () async {
|
||||||
|
|
|
@ -31,11 +31,6 @@ void main() {
|
||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
// int build
|
|
||||||
test('to test the property `build`', () async {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
67
scripts/pump-version.sh
Executable file
67
scripts/pump-version.sh
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pump one or both of the server/mobile versions in appropriate files
|
||||||
|
#
|
||||||
|
# usage: './scripts/pump-version.sh <major|minor|patch|fase> <mobile|false'>
|
||||||
|
#
|
||||||
|
# examples:
|
||||||
|
# ./scripts/pump-version.sh major false # 1.0.0+50 => 2.0.0+50
|
||||||
|
# ./scripts/pump-version.sh minor mobile # 1.0.0+50 => 1.1.0+51
|
||||||
|
# ./scripts/pump-version.sh false mobile # 1.0.0+50 => 1.0.0+51
|
||||||
|
#
|
||||||
|
|
||||||
|
SERVER_PUMP=$1
|
||||||
|
MOBILE_PUMP=$2
|
||||||
|
|
||||||
|
CURRENT_SERVER=$(cat server/package.json | jq -r '.version')
|
||||||
|
MAJOR=$(echo $CURRENT_SERVER | cut -d '.' -f1)
|
||||||
|
MINOR=$(echo $CURRENT_SERVER | cut -d '.' -f2)
|
||||||
|
PATCH=$(echo $CURRENT_SERVER | cut -d '.' -f3)
|
||||||
|
|
||||||
|
if [[ $SERVER_PUMP == "major" ]]; then
|
||||||
|
MAJOR=$((MAJOR + 1))
|
||||||
|
elif [[ $SERVER_PUMP == "minor" ]]; then
|
||||||
|
MINOR=$((MINOR + 1))
|
||||||
|
elif [[ $1 == "patch" ]]; then
|
||||||
|
PATCH=$((PATCH + 1))
|
||||||
|
elif [[ $SERVER_PUMP == "false" ]]; then
|
||||||
|
echo 'Skipping Server Pump'
|
||||||
|
else
|
||||||
|
echo 'Expected <major|minor|patch|false> for the first argument'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NEXT_SERVER=$MAJOR.$MINOR.$PATCH
|
||||||
|
|
||||||
|
CURRENT_MOBILE=$(cat mobile/pubspec.yaml | grep "^version: .*+[0-9]\+$" | cut -d "+" -f2)
|
||||||
|
NEXT_MOBILE=$CURRENT_MOBILE
|
||||||
|
if [[ $MOBILE_PUMP == "mobile" ]]; then
|
||||||
|
set $((NEXT_MOBILE++))
|
||||||
|
elif [[ $MOBILE_PUMP == "false" ]]; then
|
||||||
|
echo 'Skipping Mobile Pump'
|
||||||
|
else
|
||||||
|
echo 'Expected <mobile|false> for the second argument'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; then
|
||||||
|
|
||||||
|
echo "Pumping Server: $CURRENT_SERVER => $NEXT_SERVER"
|
||||||
|
|
||||||
|
sed -i "s/^ \"version\": \"$CURRENT_SERVER\",$/ \"version\": \"$NEXT_SERVER\",/" server/package.json
|
||||||
|
sed -i "s/^ \"version\": \"$CURRENT_SERVER\",$/ \"version\": \"$NEXT_SERVER\",/" server/package-lock.json
|
||||||
|
sed -i "s/\"android\.injected\.version\.name\" => \"$CURRENT_SERVER\",/\"android\.injected\.version\.name\" => \"$NEXT_SERVER\",/" mobile/android/fastlane/Fastfile
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$CURRENT_MOBILE" != "$NEXT_MOBILE" ]; then
|
||||||
|
|
||||||
|
echo "Pumping Mobile: $CURRENT_MOBILE => $NEXT_MOBILE"
|
||||||
|
|
||||||
|
sed -i "s/\"android\.injected\.version\.code\" => $CURRENT_MOBILE,/\"android\.injected\.version\.code\" => $NEXT_MOBILE,/" mobile/android/fastlane/Fastfile
|
||||||
|
sed -i "s/^version: $CURRENT_SERVER+$CURRENT_MOBILE$/version: $NEXT_SERVER+$NEXT_MOBILE/" mobile/pubspec.yaml
|
||||||
|
fi
|
|
@ -8,6 +8,4 @@ export class ServerVersionReponseDto implements IServerVersion {
|
||||||
minor!: number;
|
minor!: number;
|
||||||
@ApiProperty({ type: 'integer' })
|
@ApiProperty({ type: 'integer' })
|
||||||
patch!: number;
|
patch!: number;
|
||||||
@ApiProperty({ type: 'integer' })
|
|
||||||
build!: number;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
// major.minor.patch+build
|
import pkg from 'package.json';
|
||||||
// check mobile/pubspec.yml for current release version
|
|
||||||
|
const [major, minor, patch] = pkg.version.split('.');
|
||||||
|
|
||||||
export interface IServerVersion {
|
export interface IServerVersion {
|
||||||
major: number;
|
major: number;
|
||||||
minor: number;
|
minor: number;
|
||||||
patch: number;
|
patch: number;
|
||||||
build: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const serverVersion: IServerVersion = {
|
export const serverVersion: IServerVersion = {
|
||||||
major: 1,
|
major: Number(major),
|
||||||
minor: 42,
|
minor: Number(minor),
|
||||||
patch: 0,
|
patch: Number(patch),
|
||||||
build: 65,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SERVER_VERSION = `${serverVersion.major}.${serverVersion.minor}.${serverVersion.patch}`;
|
export const SERVER_VERSION = `${serverVersion.major}.${serverVersion.minor}.${serverVersion.patch}`;
|
||||||
|
|
|
@ -4448,16 +4448,12 @@
|
||||||
},
|
},
|
||||||
"patch": {
|
"patch": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"major",
|
"major",
|
||||||
"minor",
|
"minor",
|
||||||
"patch",
|
"patch"
|
||||||
"build"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"UsageByUserDto": {
|
"UsageByUserDto": {
|
||||||
|
|
4
server/package-lock.json
generated
4
server/package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "immich",
|
"name": "immich",
|
||||||
"version": "1.5.1",
|
"version": "1.42.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "immich",
|
"name": "immich",
|
||||||
"version": "1.5.1",
|
"version": "1.42.0",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/bull": "^0.6.2",
|
"@nestjs/bull": "^0.6.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "immich",
|
"name": "immich",
|
||||||
"version": "1.5.1",
|
"version": "1.42.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
14
web/src/api/open-api/api.ts
generated
14
web/src/api/open-api/api.ts
generated
|
@ -1575,12 +1575,6 @@ export interface ServerVersionReponseDto {
|
||||||
* @memberof ServerVersionReponseDto
|
* @memberof ServerVersionReponseDto
|
||||||
*/
|
*/
|
||||||
'patch': number;
|
'patch': number;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof ServerVersionReponseDto
|
|
||||||
*/
|
|
||||||
'build': number;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -3813,7 +3807,7 @@ export const AssetApiAxiosParamCreator = function (configuration?: Configuration
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
* Current this is not used in any UI element
|
||||||
* @param {number} [skip]
|
* @param {number} [skip]
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
|
@ -4499,7 +4493,7 @@ export const AssetApiFp = function(configuration?: Configuration) {
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
* Current this is not used in any UI element
|
||||||
* @param {number} [skip]
|
* @param {number} [skip]
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
|
@ -4725,7 +4719,7 @@ export const AssetApiFactory = function (configuration?: Configuration, basePath
|
||||||
return localVarFp.downloadFiles(downloadFilesDto, options).then((request) => request(axios, basePath));
|
return localVarFp.downloadFiles(downloadFilesDto, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
* Current this is not used in any UI element
|
||||||
* @param {number} [skip]
|
* @param {number} [skip]
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
|
@ -4947,7 +4941,7 @@ export class AssetApi extends BaseAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Current this is not used in any UI element
|
||||||
* @param {number} [skip]
|
* @param {number} [skip]
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
|
|
Loading…
Add table
Reference in a new issue