1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ env :
9+ DEVELOPER_DIR : /Applications/Xcode_15.4.app/Contents/Developer
10+
11+ jobs :
12+ release :
13+ name : Create Release
14+ runs-on : macos-latest
15+
16+ steps :
17+ - uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
20+
21+ - name : Select Xcode
22+ run : sudo xcode-select -switch /Applications/Xcode_15.4.app/Contents/Developer
23+
24+ - name : Install dependencies
25+ run : |
26+ brew install swiftlint swiftformat create-dmg
27+
28+ - name : Setup certificates
29+ env :
30+ BUILD_CERTIFICATE_BASE64 : ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
31+ P12_PASSWORD : ${{ secrets.P12_PASSWORD }}
32+ KEYCHAIN_PASSWORD : ${{ secrets.KEYCHAIN_PASSWORD }}
33+ run : |
34+ # Create temporary keychain
35+ security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
36+ security default-keychain -s build.keychain
37+ security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
38+
39+ # Import certificate
40+ echo $BUILD_CERTIFICATE_BASE64 | base64 --decode > certificate.p12
41+ security import certificate.p12 -k build.keychain -P "$P12_PASSWORD" -T /usr/bin/codesign
42+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
43+
44+ - name : Get version from tag
45+ id : get_version
46+ run : |
47+ VERSION=${GITHUB_REF#refs/tags/v}
48+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
49+ echo "Building version: $VERSION"
50+
51+ - name : Lint code
52+ run : make lint
53+
54+ - name : Run tests
55+ run : make test
56+
57+ - name : Build release
58+ run : make release
59+ env :
60+ VERSION : ${{ steps.get_version.outputs.VERSION }}
61+ DEVELOPMENT_TEAM : ${{ secrets.DEVELOPMENT_TEAM }}
62+
63+ - name : Notarize DMG
64+ run : make notarize
65+ env :
66+ APPLE_ID : ${{ secrets.APPLE_ID }}
67+ APPLE_PASSWORD : ${{ secrets.APPLE_PASSWORD }}
68+ DEVELOPMENT_TEAM : ${{ secrets.DEVELOPMENT_TEAM }}
69+
70+ - name : Generate checksums
71+ run : |
72+ cd build
73+ shasum -a 256 iemsw.dmg > iemsw.dmg.sha256
74+ cat iemsw.dmg.sha256
75+
76+ - name : Generate release notes
77+ id : release_notes
78+ run : |
79+ VERSION=${{ steps.get_version.outputs.VERSION }}
80+
81+ # Generate changelog since last tag
82+ LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
83+ if [ -n "$LAST_TAG" ]; then
84+ echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
85+ echo "## Changes since $LAST_TAG" >> $GITHUB_OUTPUT
86+ git log --pretty=format:"- %s (%h)" $LAST_TAG..HEAD >> $GITHUB_OUTPUT
87+ echo "" >> $GITHUB_OUTPUT
88+ echo "EOF" >> $GITHUB_OUTPUT
89+ else
90+ echo "CHANGELOG=Initial release" >> $GITHUB_OUTPUT
91+ fi
92+
93+ - name : Create Release
94+ id : create_release
95+ uses : actions/create-release@v1
96+ env :
97+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98+ with :
99+ tag_name : ${{ github.ref }}
100+ release_name : iemsw v${{ steps.get_version.outputs.VERSION }}
101+ body : |
102+ ## iemsw v${{ steps.get_version.outputs.VERSION }}
103+
104+ A macOS menu bar helper that switches between English input and native IME by pressing left/right ⌘ keys individually.
105+
106+ ### Installation
107+
108+ 1. Download `iemsw.dmg` from the assets below
109+ 2. Open the DMG file and drag iemsw.app to your Applications folder
110+ 3. Launch iemsw and grant accessibility permissions when prompted
111+ 4. The app will appear in your menu bar
112+
113+ ### Features
114+
115+ - **Left ⌘ key**: Switch to native IME (Japanese, Chinese, Korean, etc.)
116+ - **Right ⌘ key**: Switch to English input
117+ - **Optional idle timeout**: Automatically switch to English after no input
118+ - **Menu bar integration**: Easy access to preferences and controls
119+ - **Launch at login**: Optional automatic startup
120+
121+ ### System Requirements
122+
123+ - macOS 11.0 (Big Sur) or later
124+ - Accessibility permissions (granted during first launch)
125+
126+ ### Changelog
127+
128+ ${{ steps.release_notes.outputs.CHANGELOG }}
129+
130+ ### Verification
131+
132+ SHA256 checksum: See `iemsw.dmg.sha256` file in assets.
133+ draft : false
134+ prerelease : false
135+
136+ - name : Upload DMG
137+ uses : actions/upload-release-asset@v1
138+ env :
139+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
140+ with :
141+ upload_url : ${{ steps.create_release.outputs.upload_url }}
142+ asset_path : ./build/iemsw.dmg
143+ asset_name : iemsw.dmg
144+ asset_content_type : application/octet-stream
145+
146+ - name : Upload checksum
147+ uses : actions/upload-release-asset@v1
148+ env :
149+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150+ with :
151+ upload_url : ${{ steps.create_release.outputs.upload_url }}
152+ asset_path : ./build/iemsw.dmg.sha256
153+ asset_name : iemsw.dmg.sha256
154+ asset_content_type : text/plain
155+
156+ - name : Cleanup keychain
157+ if : always()
158+ run : |
159+ security delete-keychain build.keychain || true
160+ rm certificate.p12 || true
161+
162+ homebrew :
163+ name : Update Homebrew Cask
164+ runs-on : macos-latest
165+ needs : release
166+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
167+
168+ steps :
169+ - uses : actions/checkout@v4
170+
171+ - name : Get version and download URL
172+ id : get_info
173+ run : |
174+ VERSION=${GITHUB_REF#refs/tags/v}
175+ DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/iemsw.dmg"
176+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
177+ echo "DOWNLOAD_URL=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
178+
179+ - name : Download and get SHA256
180+ run : |
181+ curl -L "${{ steps.get_info.outputs.DOWNLOAD_URL }}" -o iemsw.dmg
182+ SHA256=$(shasum -a 256 iemsw.dmg | cut -d' ' -f1)
183+ echo "SHA256=$SHA256" >> $GITHUB_ENV
184+
185+ - name : Create Homebrew Cask PR
186+ uses : peter-evans/create-pull-request@v5
187+ with :
188+ token : ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
189+ push-to-fork : ${{ github.repository_owner }}/homebrew-cask
190+ branch : update-iemsw-${{ steps.get_info.outputs.VERSION }}
191+ title : ' iemsw: update to ${{ steps.get_info.outputs.VERSION }}'
192+ body : |
193+ Update iemsw to version ${{ steps.get_info.outputs.VERSION }}
194+
195+ - Version: ${{ steps.get_info.outputs.VERSION }}
196+ - Download URL: ${{ steps.get_info.outputs.DOWNLOAD_URL }}
197+ - SHA256: ${{ env.SHA256 }}
198+
199+ Generated automatically by GitHub Actions.
200+ commit-message : ' iemsw: update to ${{ steps.get_info.outputs.VERSION }}'
0 commit comments