-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (148 loc) · 6.11 KB
/
Copy pathrelease.yml
File metadata and controls
173 lines (148 loc) · 6.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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