0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-21 00:52:43 -05: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:
Jason Rasmussen 2023-01-23 22:46:37 -05:00 committed by GitHub
parent 4e6880e520
commit 443d08381a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 88 additions and 49 deletions

View file

@ -13,7 +13,6 @@ class ServerInfoNotifier extends StateNotifier<ServerInfoState> {
major: 0,
patch_: 0,
minor: 0,
build: 0,
),
isVersionMismatch: false,
versionMismatchErrorMessage: "",

View file

@ -336,7 +336,7 @@ Name | Type | Description | Notes
Current this is not used in any UI element
### Example
```dart

View file

@ -11,7 +11,6 @@ Name | Type | Description | Notes
**major** | **int** | |
**minor** | **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)

View file

@ -347,7 +347,7 @@ class AssetApi {
return null;
}
///
/// Current this is not used in any UI element
///
/// Note: This method returns the HTTP [Response].
///
@ -383,7 +383,7 @@ class AssetApi {
);
}
///
/// Current this is not used in any UI element
///
/// Parameters:
///

View file

@ -16,7 +16,6 @@ class ServerVersionReponseDto {
required this.major,
required this.minor,
required this.patch_,
required this.build,
});
int major;
@ -25,32 +24,27 @@ class ServerVersionReponseDto {
int patch_;
int build;
@override
bool operator ==(Object other) => identical(this, other) || other is ServerVersionReponseDto &&
other.major == major &&
other.minor == minor &&
other.patch_ == patch_ &&
other.build == build;
other.patch_ == patch_;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(major.hashCode) +
(minor.hashCode) +
(patch_.hashCode) +
(build.hashCode);
(patch_.hashCode);
@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() {
final json = <String, dynamic>{};
json[r'major'] = this.major;
json[r'minor'] = this.minor;
json[r'patch'] = this.patch_;
json[r'build'] = this.build;
return json;
}
@ -76,7 +70,6 @@ class ServerVersionReponseDto {
major: mapValueOfType<int>(json, r'major')!,
minor: mapValueOfType<int>(json, r'minor')!,
patch_: mapValueOfType<int>(json, r'patch')!,
build: mapValueOfType<int>(json, r'build')!,
);
}
return null;
@ -129,7 +122,6 @@ class ServerVersionReponseDto {
'major',
'minor',
'patch',
'build',
};
}

View file

@ -59,7 +59,7 @@ void main() {
// TODO
});
//
// Current this is not used in any UI element
//
//Future<Object> downloadLibrary({ num skip }) async
test('test downloadLibrary', () async {

View file

@ -31,11 +31,6 @@ void main() {
// TODO
});
// int build
test('to test the property `build`', () async {
// TODO
});
});

67
scripts/pump-version.sh Executable file
View 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

View file

@ -8,6 +8,4 @@ export class ServerVersionReponseDto implements IServerVersion {
minor!: number;
@ApiProperty({ type: 'integer' })
patch!: number;
@ApiProperty({ type: 'integer' })
build!: number;
}

View file

@ -1,18 +1,17 @@
// major.minor.patch+build
// check mobile/pubspec.yml for current release version
import pkg from 'package.json';
const [major, minor, patch] = pkg.version.split('.');
export interface IServerVersion {
major: number;
minor: number;
patch: number;
build: number;
}
export const serverVersion: IServerVersion = {
major: 1,
minor: 42,
patch: 0,
build: 65,
major: Number(major),
minor: Number(minor),
patch: Number(patch),
};
export const SERVER_VERSION = `${serverVersion.major}.${serverVersion.minor}.${serverVersion.patch}`;

View file

@ -4448,16 +4448,12 @@
},
"patch": {
"type": "integer"
},
"build": {
"type": "integer"
}
},
"required": [
"major",
"minor",
"patch",
"build"
"patch"
]
},
"UsageByUserDto": {

View file

@ -1,12 +1,12 @@
{
"name": "immich",
"version": "1.5.1",
"version": "1.42.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "immich",
"version": "1.5.1",
"version": "1.42.0",
"license": "UNLICENSED",
"dependencies": {
"@nestjs/bull": "^0.6.2",

View file

@ -1,6 +1,6 @@
{
"name": "immich",
"version": "1.5.1",
"version": "1.42.0",
"description": "",
"author": "",
"private": true,

View file

@ -1575,12 +1575,6 @@ export interface ServerVersionReponseDto {
* @memberof ServerVersionReponseDto
*/
'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 {*} [options] Override http request option.
* @throws {RequiredError}
@ -4499,7 +4493,7 @@ export const AssetApiFp = function(configuration?: Configuration) {
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* Current this is not used in any UI element
* @param {number} [skip]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -4725,7 +4719,7 @@ export const AssetApiFactory = function (configuration?: Configuration, basePath
return localVarFp.downloadFiles(downloadFilesDto, options).then((request) => request(axios, basePath));
},
/**
*
* Current this is not used in any UI element
* @param {number} [skip]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -4947,7 +4941,7 @@ export class AssetApi extends BaseAPI {
}
/**
*
* Current this is not used in any UI element
* @param {number} [skip]
* @param {*} [options] Override http request option.
* @throws {RequiredError}