Windows版ビルドエラー対応 #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release macOS DMG | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - name: Build Go binaries | |
| run: | | |
| mkdir -p build | |
| GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o build/hamlab-bridge-amd64 | |
| GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o build/hamlab-bridge-arm64 | |
| - name: Create Universal binary | |
| run: | | |
| lipo -create \ | |
| build/hamlab-bridge-amd64 \ | |
| build/hamlab-bridge-arm64 \ | |
| -output build/hamlab-bridge | |
| - name: Build Swift menubar app | |
| run: | | |
| swiftc main.swift AppDelegate.swift -o hamlab-menubar | |
| - name: Create icon | |
| run: | | |
| iconutil -c icns icon-work/icon.iconset -o icon-work/icon.icns | |
| - name: Create .app bundle | |
| run: | | |
| APP_NAME="HAMLAB Bridge" | |
| APP_DIR="dist/${APP_NAME}.app" | |
| BIN_NAME="hamlab-bridge" | |
| mkdir -p "${APP_DIR}/Contents/MacOS" | |
| mkdir -p "${APP_DIR}/Contents/Resources" | |
| # バイナリ配置 | |
| cp "build/${BIN_NAME}" "${APP_DIR}/Contents/MacOS/${BIN_NAME}" | |
| chmod +x "${APP_DIR}/Contents/MacOS/${BIN_NAME}" | |
| # メニューバーアプリ配置 | |
| cp hamlab-menubar "${APP_DIR}/Contents/MacOS/hamlab-menubar" | |
| chmod +x "${APP_DIR}/Contents/MacOS/hamlab-menubar" | |
| # アイコン配置 | |
| cp icon-work/icon.icns "${APP_DIR}/Contents/Resources/icon.icns" | |
| cp icon-work/icon.iconset/icon_16x16.png "${APP_DIR}/Contents/Resources/StatusIcon.png" | |
| cp icon-work/icon.iconset/icon_32x32.png "${APP_DIR}/Contents/Resources/StatusIcon@2x.png" | |
| # LaunchAgent plist | |
| cp jp.hamlab.bridge.plist "${APP_DIR}/Contents/Resources/jp.hamlab.bridge.plist" | |
| # Info.plist 作成 | |
| cat > "${APP_DIR}/Contents/Info.plist" <<EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
| "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleName</key> | |
| <string>${APP_NAME}</string> | |
| <key>CFBundleDisplayName</key> | |
| <string>${APP_NAME}</string> | |
| <key>CFBundleIdentifier</key> | |
| <string>jp.hamlab.bridge</string> | |
| <key>CFBundleVersion</key> | |
| <string>${GITHUB_REF_NAME}</string> | |
| <key>CFBundleShortVersionString</key> | |
| <string>${GITHUB_REF_NAME}</string> | |
| <key>CFBundleExecutable</key> | |
| <string>hamlab-menubar</string> | |
| <key>CFBundleIconFile</key> | |
| <string>icon</string> | |
| <key>CFBundlePackageType</key> | |
| <string>APPL</string> | |
| <key>LSMinimumSystemVersion</key> | |
| <string>11.0</string> | |
| <key>LSUIElement</key> | |
| <true/> | |
| </dict> | |
| </plist> | |
| EOF | |
| - name: Create DMG | |
| run: | | |
| APP_NAME="HAMLAB Bridge" | |
| DMG_DIR="dmg" | |
| mkdir -p "${DMG_DIR}" | |
| cp -R "dist/${APP_NAME}.app" "${DMG_DIR}/" | |
| ln -s /Applications "${DMG_DIR}/Applications" | |
| hdiutil create \ | |
| -volname "${APP_NAME}" \ | |
| -srcfolder "${DMG_DIR}" \ | |
| -ov \ | |
| -format UDZO \ | |
| "HAMLAB-Bridge-${GITHUB_REF_NAME}.dmg" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hamlab-bridge-macos-dmg | |
| path: HAMLAB-Bridge-*.dmg | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: HAMLAB-Bridge-*.dmg | |
| overwrite_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |