Skip to content

Commit

Permalink
chore: fix shortVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
uetchy committed Jan 5, 2021
1 parent 4ff1163 commit f98dc62
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ yarn format # => format code with SwiftFormat
## Release (Maintainers only)

```bash
VERSION=3.2.0 node Scripts/update-version.js
VERSION=3.2 BUILD=0 node Scripts/update-version.js
git add .
git commit -m 'chore: release v3.2.0'
yarn ship:mas # for Mac App Store
Expand Down
4 changes: 2 additions & 2 deletions Polyglot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Polyglot/Polyglot.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 58XDWHK3JX;
Expand All @@ -646,7 +646,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Polyglot/Polyglot.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 58XDWHK3JX;
Expand Down
2 changes: 1 addition & 1 deletion Polyglot/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2</string>
<key>CFBundleVersion</key>
<string>3.2.0</string>
<key>LSApplicationCategoryType</key>
Expand Down
2 changes: 1 addition & 1 deletion PolyglotSafariExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.2</string>
<key>CFBundleVersion</key>
<string>3.2.0</string>
<key>LSMinimumSystemVersion</key>
Expand Down
16 changes: 11 additions & 5 deletions Scripts/update-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
const path = require("path");
const fs = require("fs");
const assert = require("assert");
const { execSync } = require("child_process");
const plist = require("plist");

const bundleVersion = process.env.VERSION;
assert(bundleVersion, "specify VERSION envvar");
const shortVersion = process.env.VERSION;
assert(shortVersion, "specify VERSION envvar");

console.log(`CFBundleShortVersionString: ${bundleVersion}`);
const buildId = process.env.BUILD;
assert(buildId, "specify BUILD envvar");

const bundleVersion = shortVersion + "." + buildId;

console.log(`CFBundleShortVersionString: ${shortVersion}`);
console.log(`CFBundleVersion: ${bundleVersion}`);

// rewrite `Polyglot/Info.plist`
const appInfoPath = path.resolve(__dirname, "../Polyglot/Info.plist");
console.log(`rewriting '${appInfoPath}'`);
const appInfo = plist.parse(fs.readFileSync(appInfoPath, "utf8"));
appInfo["CFBundleShortVersionString"] = bundleVersion;
appInfo["CFBundleShortVersionString"] = shortVersion;
appInfo["CFBundleVersion"] = bundleVersion;
fs.writeFileSync(appInfoPath, plist.build(appInfo));

Expand All @@ -26,7 +32,7 @@ const extInfoPath = path.resolve(
);
console.log(`rewriting '${extInfoPath}'`);
const extInfo = plist.parse(fs.readFileSync(extInfoPath, "utf8"));
extInfo["CFBundleShortVersionString"] = bundleVersion;
extInfo["CFBundleShortVersionString"] = shortVersion;
extInfo["CFBundleVersion"] = bundleVersion;
fs.writeFileSync(extInfoPath, plist.build(extInfo));

Expand Down

0 comments on commit f98dc62

Please sign in to comment.