Skip to content

fix installer build issues #17

fix installer build issues

fix installer build issues #17

Workflow file for this run

name: Build and Test
on:
push:
branches: [master, main]
tags:
- 'v*'
pull_request:
branches: [master, main]
env:
GO_VERSION: '1.24'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgl1-mesa-dev \
libxcursor-dev \
libxrandr-dev \
libxinerama-dev \
libxi-dev \
libxxf86vm-dev \
libasound2-dev \
libxcb-util-dev \
libxcb-icccm4-dev \
libxcb-xfixes0-dev \
pkg-config
- name: Add static library replacements
run: |
go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600
go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.9.152
go get .
- name: Run tests
run: go test -v ./...
build-linux:
name: Build Linux
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgl1-mesa-dev \
libxcursor-dev \
libxrandr-dev \
libxinerama-dev \
libxi-dev \
libxxf86vm-dev \
libasound2-dev \
libxcb-util-dev \
libxcb-icccm4-dev \
libxcb-xfixes0-dev \
pkg-config
- name: Add static library replacements
run: |
go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600
go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.9.152
go get .
- name: Build
run: |
CGO_ENABLED=1 go build -v -ldflags="-s -w" -o shells-go-linux-amd64 .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: shells-go-linux-amd64
path: shells-go-linux-amd64
build-windows:
name: Build Windows
runs-on: windows-latest
needs: test
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-go
mingw-w64-x86_64-pkg-config
- name: Add static library replacements
run: |
go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600
go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.9.152
go get .
- name: Build
run: |
export CGO_ENABLED=1
go build -v -ldflags="-s -w" -o shells-go-windows-amd64.exe .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: shells-go-windows-amd64
path: shells-go-windows-amd64.exe
- name: Create Windows Installer
shell: pwsh
run: |
Copy-Item shells-go-windows-amd64.exe installer/win64/Shells.exe
choco install nsis -y
cd installer/win64
& "C:\Program Files (x86)\NSIS\makensis.exe" installer.nsi
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: shells-windows-installer
path: installer/win64/ShellsSetup.exe
build-macos-intel:
name: Build macOS Intel
runs-on: macos-15-intel
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Add static library replacements
run: |
go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600
go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.9.152
go get .
- name: Build
run: |
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w" -o shells-go-darwin-amd64 .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: shells-go-darwin-amd64
path: shells-go-darwin-amd64
build-macos-arm:
name: Build macOS ARM + Universal Binary
runs-on: macos-latest
needs: [test, build-macos-intel]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Add static library replacements
run: |
go mod edit -replace github.com/gordonklaus/portaudio=github.com/KarpelesLab/static-portaudio@v0.6.190600
go mod edit -replace github.com/hraban/opus=github.com/KarpelesLab/static-opus@v0.9.152
go get .
- name: Build ARM64
run: |
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w" -o shells-go-darwin-arm64 .
- name: Download Intel binary
uses: actions/download-artifact@v4
with:
name: shells-go-darwin-amd64
- name: Create Universal Binary
run: |
lipo -create -output shells-go-darwin-universal shells-go-darwin-amd64 shells-go-darwin-arm64
file shells-go-darwin-universal
- name: Upload ARM64 artifact
uses: actions/upload-artifact@v4
with:
name: shells-go-darwin-arm64
path: shells-go-darwin-arm64
- name: Upload Universal Binary artifact
uses: actions/upload-artifact@v4
with:
name: shells-go-darwin-universal
path: shells-go-darwin-universal
- name: Install fyne CLI
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Create macOS App Bundle
run: |
# Get version from tag or use default
VERSION=${GITHUB_REF#refs/tags/v}
if [[ "$VERSION" == "$GITHUB_REF" ]]; then
VERSION="0.0.0"
fi
# Create app bundle using fyne with universal binary
cp shells-go-darwin-universal shells-go
fyne package -os darwin -name Shells -appID com.shells.app -appVersion "$VERSION"
rm -f shells-go
# Replace binary with universal binary
cp shells-go-darwin-universal Shells.app/Contents/MacOS/shells-go
# Create pkg installer (unsigned for CI)
mkdir -p build
mv Shells.app build/
pkgbuild --root build --identifier "com.shells.app" --version "$VERSION" \
--install-location "/Applications" Shells.pkg
- name: Upload macOS pkg artifact
uses: actions/upload-artifact@v4
with:
name: shells-macos-pkg
path: Shells.pkg
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build-linux, build-windows, build-macos-arm]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
VERSION=${GITHUB_REF#refs/tags/}
# Linux - tar.gz
tar -czvf release/shells-go-linux-amd64-${VERSION}.tar.gz \
-C artifacts/shells-go-linux-amd64 shells-go-linux-amd64
# Windows - zip (raw binary)
cd artifacts/shells-go-windows-amd64
zip ../../release/shells-go-windows-amd64-${VERSION}.zip shells-go-windows-amd64.exe
cd ../..
# Windows - installer
cp artifacts/shells-windows-installer/ShellsSetup.exe \
release/ShellsSetup-${VERSION}.exe
# macOS Intel - tar.gz
tar -czvf release/shells-go-darwin-amd64-${VERSION}.tar.gz \
-C artifacts/shells-go-darwin-amd64 shells-go-darwin-amd64
# macOS ARM - tar.gz
tar -czvf release/shells-go-darwin-arm64-${VERSION}.tar.gz \
-C artifacts/shells-go-darwin-arm64 shells-go-darwin-arm64
# macOS Universal - tar.gz
tar -czvf release/shells-go-darwin-universal-${VERSION}.tar.gz \
-C artifacts/shells-go-darwin-universal shells-go-darwin-universal
# macOS - pkg installer
cp artifacts/shells-macos-pkg/Shells.pkg \
release/Shells-${VERSION}.pkg
# Generate checksums
cd release
sha256sum * > checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: false
generate_release_notes: true
files: release/*