fix(macos): reabrir janela ao clicar no Dock e ocultar janela ao fech… #17
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 Multiplataforma | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.title || matrix.os }} (${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Windows x64 | |
| - os: windows | |
| title: Windows | |
| runner: windows-latest | |
| arch: amd64 | |
| binary_name: ipMonitorApp.exe | |
| asset_name: ipMonitorApp-windows-amd64.zip | |
| # Linux x64 | |
| - os: linux | |
| title: Linux | |
| runner: ubuntu-latest | |
| arch: amd64 | |
| binary_name: ipMonitorApp | |
| asset_name: ipMonitorApp-linux-amd64.tar.gz | |
| # macOS Apple Silicon (arm64 - M1/M2/M3/M4) | |
| - os: darwin | |
| title: Darwin Apple Silicon | |
| runner: macos-latest | |
| arch: arm64 | |
| goarch: arm64 | |
| binary_name: ipMonitorApp | |
| asset_name: ipMonitorApp-AppleSilicon-arm64.dmg | |
| # macOS Intel (amd64) via compilação nativa no runner macOS | |
| - os: darwin | |
| title: Darwin Intel | |
| runner: macos-latest | |
| arch: amd64 | |
| goarch: amd64 | |
| binary_name: ipMonitorApp | |
| asset_name: ipMonitorApp-Intel-x86_64.dmg | |
| steps: | |
| - name: Checkout repositório | |
| uses: actions/checkout@v4 | |
| - name: Configurar Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| check-latest: true | |
| - name: Instalar dependências Linux (GTK4 & WebKitGTK 6.0 para Wails v3) | |
| if: matrix.os == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-4-dev libwebkitgtk-6.0-dev gcc pkg-config libsoup-3.0-dev | |
| - name: Executar Testes Unitários | |
| run: go test -v ./... | |
| - name: Compilar Binário (Windows) | |
| if: matrix.os == 'windows' | |
| env: | |
| CGO_ENABLED: '0' | |
| run: | | |
| go build -ldflags="-s -w -H=windowsgui" -o ${{ matrix.binary_name }} . | |
| Compress-Archive -Path ${{ matrix.binary_name }} -DestinationPath ${{ matrix.asset_name }} | |
| - name: Compilar Binário (Linux) | |
| if: matrix.os == 'linux' | |
| env: | |
| CGO_ENABLED: '1' | |
| GOARCH: ${{ matrix.arch }} | |
| run: | | |
| go build -ldflags="-s -w" -o ${{ matrix.binary_name }} . | |
| chmod +x ${{ matrix.binary_name }} | |
| tar -czvf ${{ matrix.asset_name }} ${{ matrix.binary_name }} | |
| - name: Compilar e Empacotar .app Bundle (macOS) | |
| if: matrix.os == 'darwin' | |
| env: | |
| CGO_ENABLED: '1' | |
| GOARCH: ${{ matrix.arch }} | |
| run: | | |
| # 1. Compila o binário Go nativo | |
| go build -ldflags="-s -w" -o ${{ matrix.binary_name }} . | |
| chmod +x ${{ matrix.binary_name }} | |
| # 2. Converte ícone PNG para .icns nativo do macOS usando iconutil | |
| mkdir -p AppIcon.iconset | |
| sips -z 16 16 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_16x16.png | |
| sips -z 32 32 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_16x16@2x.png | |
| sips -z 32 32 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_32x32.png | |
| sips -z 64 64 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_32x32@2x.png | |
| sips -z 128 128 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_128x128.png | |
| sips -z 256 256 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_128x128@2x.png | |
| sips -z 256 256 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_256x256.png | |
| sips -z 512 512 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_256x256@2x.png | |
| sips -z 512 512 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_512x512.png | |
| sips -z 1024 1024 internal/assets/icons/app-icon.png --out AppIcon.iconset/icon_512x512@2x.png | |
| iconutil -c icns AppIcon.iconset -o AppIcon.icns | |
| rm -rf AppIcon.iconset | |
| # 3. Monta a estrutura oficial do macOS .app | |
| APP_BUNDLE="IP Monitor.app" | |
| mkdir -p "$APP_BUNDLE/Contents/MacOS" | |
| mkdir -p "$APP_BUNDLE/Contents/Resources" | |
| cp "${{ matrix.binary_name }}" "$APP_BUNDLE/Contents/MacOS/${{ matrix.binary_name }}" | |
| cp build/darwin/Info.plist "$APP_BUNDLE/Contents/Info.plist" | |
| cp AppIcon.icns "$APP_BUNDLE/Contents/Resources/AppIcon.icns" | |
| rm -f AppIcon.icns | |
| # 4. Remove atributos estendidos pré-existentes e assina o .app digitalmente (Ad-hoc) | |
| xattr -cr "$APP_BUNDLE" | |
| codesign --force --deep --sign - "$APP_BUNDLE" | |
| codesign --verify --deep --strict "$APP_BUNDLE" | |
| # 5. Cria Imagem de Disco Nativa (.dmg) com atalho para /Applications | |
| DMG_TMP="dmg_staging" | |
| mkdir -p "$DMG_TMP" | |
| cp -R "$APP_BUNDLE" "$DMG_TMP/" | |
| ln -s /Applications "$DMG_TMP/Applications" | |
| # Cria o DMG formatado em UDZO (compactado e somente leitura) | |
| hdiutil create -volname "IP Monitor" -srcfolder "$DMG_TMP" -ov -format UDZO "${{ matrix.asset_name }}" | |
| rm -rf "$DMG_TMP" | |
| # 6. Assina o próprio container DMG com Ad-hoc codesign | |
| codesign --force --sign - "${{ matrix.asset_name }}" | |
| - name: Upload Artifact temporário | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.asset_name }} | |
| release: | |
| name: Publicar GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repositório | |
| uses: actions/checkout@v4 | |
| - name: Baixar todos os executáveis compilados | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release_assets | |
| merge-multiple: true | |
| - name: Listar arquivos compilados | |
| run: ls -la release_assets/ | |
| - name: Criar GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release_assets/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false |