1+ # KeepKey Desktop Release Makefile
2+ # Local release process without CI/CD
3+
4+ # Variables
5+ VERSION := $(shell node -p "require('./packages/keepkey-desktop/package.json') .version")
6+ RELEASE_BRANCH := release-$(VERSION )
7+ APP_NAME := KeepKey Desktop
8+ BUILD_DIR := packages/keepkey-desktop/dist
9+ DMG_PATH := $(BUILD_DIR ) /KeepKey*.dmg
10+ ZIP_PATH := $(BUILD_DIR ) /KeepKey*.zip
11+ WINDOWS_PATH := $(BUILD_DIR ) /KeepKey*.exe
12+ LINUX_DEB_PATH := $(BUILD_DIR ) /keepkey*.deb
13+ LINUX_APPIMAGE_PATH := $(BUILD_DIR ) /KeepKey*.AppImage
14+
15+ # Colors for output
16+ RED := \033[0;31m
17+ GREEN := \033[0;32m
18+ YELLOW := \033[1;33m
19+ NC := \033[0m # No Color
20+
21+ .PHONY : help version tag release build-mac sign-mac notarize upload-release clean
22+
23+ help :
24+ @echo " $( GREEN) KeepKey Desktop Release Process$( NC) "
25+ @echo " "
26+ @echo " Available targets:"
27+ @echo " $( YELLOW) version$( NC) - Display current version"
28+ @echo " $( YELLOW) tag$( NC) - Create and push git tag for current version"
29+ @echo " $( YELLOW) release$( NC) - Create GitHub release with gh cli"
30+ @echo " $( YELLOW) build-mac$( NC) - Build macOS release locally"
31+ @echo " $( YELLOW) build-windows$( NC) - Build Windows release locally"
32+ @echo " $( YELLOW) build-linux$( NC) - Build Linux release locally"
33+ @echo " $( YELLOW) sign-mac$( NC) - Sign macOS build locally"
34+ @echo " $( YELLOW) notarize$( NC) - Notarize macOS build with Apple"
35+ @echo " $( YELLOW) upload-release$( NC) - Upload built artifacts to GitHub release"
36+ @echo " $( YELLOW) clean$( NC) - Clean build artifacts"
37+ @echo " "
38+ @echo " $( GREEN) Full release workflow:$( NC) "
39+ @echo " 1. make tag"
40+ @echo " 2. make release"
41+ @echo " 3. make build-mac"
42+ @echo " 4. make sign-mac"
43+ @echo " 5. make notarize"
44+ @echo " 6. make upload-release"
45+
46+ version :
47+ @echo " Current version: $( GREEN) $( VERSION) $( NC) "
48+ @echo " Release branch: $( GREEN) $( RELEASE_BRANCH) $( NC) "
49+
50+ # Create and push git tag
51+ tag :
52+ @echo " $( YELLOW) Creating tag v$( VERSION) ...$( NC) "
53+ @if git rev-parse " v$( VERSION) " > /dev/null 2>&1 ; then \
54+ echo " $( RED) Tag v$( VERSION) already exists!$( NC) " ; \
55+ exit 1; \
56+ fi
57+ @git tag -a " v$( VERSION) " -m " Release v$( VERSION) "
58+ @git push origin " v$( VERSION) "
59+ @echo " $( GREEN) Tag v$( VERSION) created and pushed!$( NC) "
60+
61+ # Create GitHub release
62+ release :
63+ @echo " $( YELLOW) Creating GitHub release v$( VERSION) ...$( NC) "
64+ @gh release create " v$( VERSION) " \
65+ --title " $( APP_NAME) v$( VERSION) " \
66+ --notes " Release v$( VERSION) " \
67+ --draft
68+ @echo " $( GREEN) Draft release created! Edit release notes on GitHub.$( NC) "
69+
70+ # Build macOS release
71+ build-mac :
72+ @echo " $( YELLOW) Building macOS release...$( NC) "
73+ @echo " $( YELLOW) Installing dependencies...$( NC) "
74+ @yarn install
75+ @echo " $( YELLOW) Building application...$( NC) "
76+ @yarn run build
77+ @echo " $( YELLOW) Creating macOS packages...$( NC) "
78+ @cd packages/keepkey-desktop && yarn run release
79+ @echo " $( GREEN) macOS build complete!$( NC) "
80+
81+ # Build Windows release
82+ build-windows :
83+ @echo " $( YELLOW) Building Windows release...$( NC) "
84+ @echo " $( YELLOW) Installing dependencies...$( NC) "
85+ @yarn install
86+ @echo " $( YELLOW) Building application...$( NC) "
87+ @yarn run build
88+ @echo " $( YELLOW) Creating Windows packages...$( NC) "
89+ @cd packages/keepkey-desktop && yarn electron-builder --win
90+ @echo " $( GREEN) Windows build complete!$( NC) "
91+
92+ # Build Linux release
93+ build-linux :
94+ @echo " $( YELLOW) Building Linux release...$( NC) "
95+ @echo " $( YELLOW) Installing dependencies...$( NC) "
96+ @yarn install
97+ @echo " $( YELLOW) Building application...$( NC) "
98+ @yarn run build
99+ @echo " $( YELLOW) Creating Linux packages...$( NC) "
100+ @cd packages/keepkey-desktop && yarn electron-builder --linux
101+ @echo " $( GREEN) Linux build complete!$( NC) "
102+
103+ # Sign macOS build locally
104+ sign-mac :
105+ @echo " $( YELLOW) Signing macOS build...$( NC) "
106+ @if [ -z " $( APPLE_ID) " ]; then \
107+ echo " $( RED) Error: APPLE_ID environment variable not set!$( NC) " ; \
108+ echo " Export it with: export APPLE_ID=your-apple-id" ; \
109+ exit 1; \
110+ fi
111+ @if [ -z " $( APPLE_APP_SPECIFIC_PASSWORD) " ]; then \
112+ echo " $( RED) Error: APPLE_APP_SPECIFIC_PASSWORD environment variable not set!$( NC) " ; \
113+ echo " Export it with: export APPLE_APP_SPECIFIC_PASSWORD=your-app-password" ; \
114+ exit 1; \
115+ fi
116+ @echo " $( GREEN) Environment variables set, signing will occur during build process.$( NC) "
117+
118+ # Notarize macOS build
119+ notarize :
120+ @echo " $( YELLOW) Notarizing macOS build...$( NC) "
121+ @if [ -z " $( APPLE_ID) " ] || [ -z " $( APPLE_APP_SPECIFIC_PASSWORD) " ]; then \
122+ echo " $( RED) Error: Apple credentials not set!$( NC) " ; \
123+ echo " Set APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD environment variables" ; \
124+ exit 1; \
125+ fi
126+ @echo " $( YELLOW) Notarization will run automatically via afterSign.js during build$( NC) "
127+ @echo " $( GREEN) To manually notarize, use: xcrun notarytool submit [dmg-file] --apple-id $( APPLE_ID) --team-id DR57X8Z394$( NC) "
128+
129+ # Upload built artifacts to GitHub release
130+ upload-release :
131+ @echo " $( YELLOW) Uploading release artifacts to GitHub...$( NC) "
132+ @echo " $( YELLOW) Uploading macOS artifacts...$( NC) "
133+ @if ls $(DMG_PATH ) 1> /dev/null 2>&1 ; then \
134+ gh release upload " v$( VERSION) " $(DMG_PATH ) --clobber; \
135+ echo " $( GREEN) DMG uploaded$( NC) " ; \
136+ else \
137+ echo " $( YELLOW) No DMG found$( NC) " ; \
138+ fi
139+ @if ls $(ZIP_PATH ) 1> /dev/null 2>&1 ; then \
140+ gh release upload " v$( VERSION) " $(ZIP_PATH ) --clobber; \
141+ echo " $( GREEN) ZIP uploaded$( NC) " ; \
142+ else \
143+ echo " $( YELLOW) No ZIP found$( NC) " ; \
144+ fi
145+ @echo " $( YELLOW) Uploading Windows artifacts...$( NC) "
146+ @if ls $(WINDOWS_PATH ) 1> /dev/null 2>&1 ; then \
147+ gh release upload " v$( VERSION) " $(WINDOWS_PATH ) --clobber; \
148+ echo " $( GREEN) Windows installer uploaded$( NC) " ; \
149+ else \
150+ echo " $( YELLOW) No Windows installer found$( NC) " ; \
151+ fi
152+ @echo " $( YELLOW) Uploading Linux artifacts...$( NC) "
153+ @if ls $(LINUX_DEB_PATH ) 1> /dev/null 2>&1 ; then \
154+ gh release upload " v$( VERSION) " $(LINUX_DEB_PATH ) --clobber; \
155+ echo " $( GREEN) DEB package uploaded$( NC) " ; \
156+ else \
157+ echo " $( YELLOW) No DEB package found$( NC) " ; \
158+ fi
159+ @if ls $(LINUX_APPIMAGE_PATH ) 1> /dev/null 2>&1 ; then \
160+ gh release upload " v$( VERSION) " $(LINUX_APPIMAGE_PATH ) --clobber; \
161+ echo " $( GREEN) AppImage uploaded$( NC) " ; \
162+ else \
163+ echo " $( YELLOW) No AppImage found$( NC) " ; \
164+ fi
165+ @echo " $( GREEN) All artifacts uploaded!$( NC) "
166+
167+ # Full macOS release (build, sign, notarize)
168+ release-mac : sign-mac build-mac
169+ @echo " $( GREEN) macOS release build complete with signing and notarization!$( NC) "
170+
171+ # Clean build artifacts
172+ clean :
173+ @echo " $( YELLOW) Cleaning build artifacts...$( NC) "
174+ @yarn clean
175+ @echo " $( GREEN) Clean complete!$( NC) "
176+
177+ # Update version in package.json files
178+ bump-version :
179+ @echo " $( YELLOW) Current version: $( VERSION) $( NC) "
180+ @read -p " Enter new version: " NEW_VERSION; \
181+ node -e " const fs = require('fs'); \
182+ const pkg = require(' ./packages/keepkey-desktop/package.json' ); \
183+ pkg.version = ' $$NEW_VERSION' ; \
184+ fs.writeFileSync(' ./packages/keepkey-desktop/package.json' , JSON.stringify(pkg, null, 4)); "
185+ @echo " $( GREEN) Version bumped to $$ NEW_VERSION$( NC) "
186+ @echo " $( YELLOW) Don't forget to commit the version change!$( NC) "
187+
188+ # Publish release (remove draft status)
189+ publish-release :
190+ @echo " $( YELLOW) Publishing release v$( VERSION) ...$( NC) "
191+ @gh release edit " v$( VERSION) " --draft=false
192+ @echo " $( GREEN) Release v$( VERSION) is now published!$( NC) "
193+
194+ # Complete release workflow
195+ full-release : tag release release-mac upload-release publish-release
196+ @echo " $( GREEN) Full release v$( VERSION) complete!$( NC) "
0 commit comments