From ce42b84430c0622647358f7cb21e934a2c1eab6d Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 28 Apr 2023 22:10:32 -0400 Subject: [PATCH] build: improve pump script (#2351) --- misc/release/pump-version.sh | 13 ++----------- server/bin/sync-spec-version.js | 6 ++++++ server/package.json | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) create mode 100644 server/bin/sync-spec-version.js diff --git a/misc/release/pump-version.sh b/misc/release/pump-version.sh index 84f3fa3163..a0b2f0b6cb 100755 --- a/misc/release/pump-version.sh +++ b/misc/release/pump-version.sh @@ -61,26 +61,17 @@ fi if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; then echo "Pumping Server: $CURRENT_SERVER => $NEXT_SERVER" + npm --prefix server version $SERVER_PUMP + npm --prefix server run api:generate fi if [ "$CURRENT_MOBILE" != "$NEXT_MOBILE" ]; then echo "Pumping Mobile: $CURRENT_MOBILE => $NEXT_MOBILE" fi -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/\"version\": \"$CURRENT_SERVER\",$/\"version\": \"$NEXT_SERVER\",/" server/immich-openapi-specs.json sed -i "s/\"android\.injected\.version\.name\" => \"$CURRENT_SERVER\",/\"android\.injected\.version\.name\" => \"$NEXT_SERVER\",/" mobile/android/fastlane/Fastfile sed -i "s/version_number: \"$CURRENT_SERVER\"$/version_number: \"$NEXT_SERVER\"/" mobile/ios/fastlane/Fastfile 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 -# OpenApi Generated Files -sed -i "s/API version: $CURRENT_SERVER,$/API version: $NEXT_SERVER/" mobile/openapi/README.md -sed -i "s/OpenAPI document: $CURRENT_SERVER,$/OpenAPI document: $NEXT_SERVER/" web/src/api/open-api/api.ts -sed -i "s/OpenAPI document: $CURRENT_SERVER,$/OpenAPI document: $NEXT_SERVER/" web/src/api/open-api/base.ts -sed -i "s/OpenAPI document: $CURRENT_SERVER,$/OpenAPI document: $NEXT_SERVER/" web/src/api/open-api/common.ts -sed -i "s/OpenAPI document: $CURRENT_SERVER,$/OpenAPI document: $NEXT_SERVER/" web/src/api/open-api/configuration.ts -sed -i "s/OpenAPI document: $CURRENT_SERVER,$/OpenAPI document: $NEXT_SERVER/" web/src/api/open-api/index.ts - echo "IMMICH_VERSION=v$NEXT_SERVER" >>$GITHUB_ENV diff --git a/server/bin/sync-spec-version.js b/server/bin/sync-spec-version.js new file mode 100644 index 0000000000..8de54b64bb --- /dev/null +++ b/server/bin/sync-spec-version.js @@ -0,0 +1,6 @@ +const spec = require('../immich-openapi-specs.json'); +const pkg = require('../package.json'); +const path = require('path'); +const fs = require('fs'); +spec.info.version = pkg.version; +fs.writeFileSync(path.join(__dirname, '../immich-openapi-specs.json'), JSON.stringify(spec, null, 2)); diff --git a/server/package.json b/server/package.json index 4580cd5f82..7ae66290e8 100644 --- a/server/package.json +++ b/server/package.json @@ -37,7 +37,7 @@ "typeorm:schema:reset": "npm run typeorm:schema:drop && npm run typeorm:migrations:run", "api:typescript": "bash ./bin/generate-open-api.sh web", "api:dart": "bash ./bin/generate-open-api.sh mobile", - "api:generate": "bash ./bin/generate-open-api.sh" + "api:generate": "node ./bin/sync-spec-version.js && bash ./bin/generate-open-api.sh" }, "dependencies": { "@babel/runtime": "^7.20.13",