Skip to content

Commit

Permalink
feat: add version to the app menubar and release archives (closes #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Pontoise committed Oct 17, 2019
1 parent d80ab88 commit de6ad7f
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ install:
- npm ci
script:
- npx commitlint-travis
- ci/determine_version.sh
- ci/set_version_in_app.sh
- xcodebuild
- ci/package_release.sh
- if [ $TRAVIS_BRANCH == "master" ]; then npx semantic-release; fi
before_deploy: cd build/Release && zip -r alt-tab-macos.zip alt-tab-macos.app && tar czf alt-tab-macos.tar.gz alt-tab-macos.app
deploy:
provider: releases
api_key:
Expand Down
14 changes: 14 additions & 0 deletions alt-tab-macos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
D04BA32F25860B686DFE818A /* 3 windows - 1 line.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "3 windows - 1 line.jpg"; sourceTree = "<group>"; };
D04BA35456DA0DDA74F9687E /* Keyboard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Keyboard.swift; sourceTree = "<group>"; };
D04BA4336B6004A0A99849AD /* package.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = package.json; sourceTree = "<group>"; };
D04BA4B5292629AA6B560216 /* package_release.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = package_release.sh; sourceTree = "<group>"; };
D04BA4F23325560BC0BCDDB7 /* 7 windows - 2 lines - tall window.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "7 windows - 2 lines - tall window.jpg"; sourceTree = "<group>"; };
D04BA51D43775E57CE91154A /* 3 windows - 1 line - wide window.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "3 windows - 1 line - wide window.jpg"; sourceTree = "<group>"; };
D04BA56355579F78776E6D51 /* Cell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cell.swift; sourceTree = "<group>"; };
D04BA5ABFA5457A86536E2E4 /* 5 windows - 1 line.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "5 windows - 1 line.jpg"; sourceTree = "<group>"; };
D04BA5E4A1745A481CEC1EBA /* 5 windows - 2 lines.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "5 windows - 2 lines.png"; sourceTree = "<group>"; };
D04BA5E9CB56E27CC907F07D /* 6 windows - 2 lines.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "6 windows - 2 lines.png"; sourceTree = "<group>"; };
D04BA7B6AAB0812631BBC7A2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.info; path = Info.plist; sourceTree = "<group>"; };
D04BA7ECCE728582D9ECA613 /* determine_version.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = determine_version.sh; sourceTree = "<group>"; };
D04BA82F792DF53958D92572 /* alt-tab-macos.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "alt-tab-macos.app"; sourceTree = BUILT_PRODUCTS_DIR; };
D04BA8924E1644C932B8CBAA /* preferences.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = preferences.json; sourceTree = "<group>"; };
D04BA8DDB96B0A60C3394351 /* dark-background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "dark-background.png"; sourceTree = "<group>"; };
Expand All @@ -47,6 +49,7 @@
D04BAA44C837F3A67403B9DB /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
D04BAB6652494D7575057E86 /* 14 windows - 3 lines.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "14 windows - 3 lines.jpg"; sourceTree = "<group>"; };
D04BAC02D60EF22D9CC7D969 /* commitlint.config.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = commitlint.config.js; sourceTree = "<group>"; };
D04BAC6AFC7F06D1A567F27A /* set_version_in_app.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = set_version_in_app.sh; sourceTree = "<group>"; };
D04BAD1BED44EAEB77FED8A4 /* WindowManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WindowManager.swift; sourceTree = "<group>"; };
D04BAD1C9F215BCCD3B620AC /* alt_tab_macos.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = alt_tab_macos.entitlements; sourceTree = "<group>"; };
D04BAD40CE2D3A8AAC3819D0 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = file.gitignore; path = .gitignore; sourceTree = "<group>"; };
Expand Down Expand Up @@ -84,6 +87,7 @@
D04BA4336B6004A0A99849AD /* package.json */,
D04BA92541D46EA4F6943A72 /* package-lock.json */,
D04BAFA277EAE3BDDDB61110 /* CHANGELOG.md */,
D04BA703DCD38D9757093312 /* ci */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -135,6 +139,16 @@
path = "alt-tab-macos";
sourceTree = "<group>";
};
D04BA703DCD38D9757093312 /* ci */ = {
isa = PBXGroup;
children = (
D04BA7ECCE728582D9ECA613 /* determine_version.sh */,
D04BA4B5292629AA6B560216 /* package_release.sh */,
D04BAC6AFC7F06D1A567F27A /* set_version_in_app.sh */,
);
path = ci;
sourceTree = "<group>";
};
D04BAA1C553891551B903DA7 /* logic */ = {
isa = PBXGroup;
children = (
Expand Down
4 changes: 4 additions & 0 deletions alt-tab-macos/ui/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate, NSCol
item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
item!.button!.title = "AltTab"
item!.menu = NSMenu()
item!.menu!.addItem(
withTitle: "Version #VERSION#",
action: nil,
keyEquivalent: "")
item!.menu!.addItem(
withTitle: "Quit \(ProcessInfo.processInfo.processName)",
action: #selector(NSApplication.terminate(_:)),
Expand Down
8 changes: 8 additions & 0 deletions ci/determine_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -ex

semanticRelease=$(npx semantic-release --dry-run --ci false)
version=$(echo "$semanticRelease" | sed -nE 's/.+The next release version is (.+)/\1/p')

echo "$version" > VERSION.txt
11 changes: 11 additions & 0 deletions ci/package_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -ex

appName="AltTab"
version="$(cat VERSION.txt)"

cd build/Release
mv "alt-tab-macos.app" "$appName.app"
zip -r "$appName-$version.zip" "$appName.app"
tar czf "$appName-$version.tar.gz" "$appName.app"
6 changes: 6 additions & 0 deletions ci/set_version_in_app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -ex

version="$(cat VERSION.txt)"
sed -i '' -e "s/#VERSION#/$version/" alt-tab-macos/ui/Application.swift

0 comments on commit de6ad7f

Please sign in to comment.