Skip to content

ci: use macos-latest runner and set GOARCH for fast build #5

ci: use macos-latest runner and set GOARCH for fast build

ci: use macos-latest runner and set GOARCH for fast build #5

Workflow file for this run

name: Release Multiplataforma
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# Windows x64
- os: windows
runner: windows-latest
arch: amd64
binary_name: ipMonitorApp.exe
asset_name: ipMonitorApp-windows-amd64.zip
# Linux x64
- os: 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
runner: macos-latest
arch: arm64
goarch: arm64
binary_name: ipMonitorApp
asset_name: ipMonitorApp-darwin-arm64.tar.gz
# macOS Intel (amd64) via compilação nativa no runner macOS
- os: darwin
runner: macos-latest
arch: amd64
goarch: amd64
binary_name: ipMonitorApp
asset_name: ipMonitorApp-darwin-amd64.tar.gz
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: '1'
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 / macOS)
if: matrix.os != 'windows'
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: 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