adb-toolkit/.github/workflows/build.yml

189 lines
6.5 KiB
YAML

name: Build ATK
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
GO_VERSION: "1.23"
NODE_VERSION: "20"
PNPM_VERSION: "10"
jobs:
build-linux:
name: Build Linux (deb + AppImage)
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev fuse libfuse2
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
- name: Install frontend dependencies
run: pnpm install
working-directory: frontend
- name: Set webkit pkg-config path
run: |
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV
echo "CGO_CFLAGS=$(pkg-config --cflags webkit2gtk-4.1)" >> $GITHUB_ENV
echo "CGO_LDFLAGS=$(pkg-config --libs webkit2gtk-4.1)" >> $GITHUB_ENV
- name: Download Go modules
run: go mod download
- name: Build binary
run: wails build -tags webkit2_41
- name: Generate icon and desktop file
run: |
mkdir -p build
cp assets/appicon.png build/appicon.png
cp assets/atk.desktop build/atk.desktop
- name: Build .deb
run: |
nfpm pkg --packager deb --target build/
mv build/atk_*.deb "build/ATK-${{ github.ref_name }}-amd64.deb" || true
- name: Build AppImage
run: |
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
mkdir -p AppDir/usr/bin AppDir/usr/share/applications AppDir/usr/share/icons/hicolor/256x256/apps
cp build/bin/ATK AppDir/usr/bin/ATK
cp build/atk.desktop AppDir/usr/share/applications/ATK.desktop
cp build/appicon.png AppDir/usr/share/icons/hicolor/256x256/apps/atk.png
ARCH=x86_64 ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage
find . -maxdepth 1 -name "*.AppImage" -not -name "linuxdeploy*" -exec mv {} "build/ATK-${{ github.ref_name }}-x86_64.AppImage" \;
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: "atk-linux-${{ github.ref_name }}"
path: |
build/bin/ATK
build/*.deb
build/*.AppImage
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: "ATK ${{ github.ref_name }}"
body: "ATK Android Toolkit ${{ github.ref_name }}"
files: |
build/ATK-${{ github.ref_name }}-amd64.deb
build/ATK-${{ github.ref_name }}-x86_64.AppImage
build/bin/ATK
draft: false
prerelease: false
build-windows:
name: Build Windows (exe)
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install frontend dependencies
run: pnpm install
working-directory: frontend
- name: Download Go modules
run: go mod download
- name: Build Windows binary
run: wails build
- name: Rename output
shell: cmd
run: copy "build\bin\ATK.exe" "build\ATK-${{ github.ref_name }}-windows-amd64.exe"
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: "atk-windows-${{ github.ref_name }}"
path: build/ATK-${{ github.ref_name }}-windows-amd64.exe
- name: Upload to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/ATK-${{ github.ref_name }}-windows-amd64.exe
build-macos:
name: Build macOS (unsigned DMG)
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install frontend dependencies
run: pnpm install
working-directory: frontend
- name: Download Go modules
run: go mod download
- name: Build macOS binary
run: wails build
- name: Create DMG
run: |
mkdir -p dmg_staging
if [ -d "build/bin/ATK.app" ]; then
cp -r build/bin/ATK.app dmg_staging/
else
cp build/bin/ATK dmg_staging/
fi
hdiutil create -volname "ATK" -srcfolder dmg_staging -ov -format UDZO "build/ATK-${{ github.ref_name }}-macos-unsigned.dmg"
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: "atk-macos-${{ github.ref_name }}"
path: build/ATK-${{ github.ref_name }}-macos-unsigned.dmg
- name: Upload to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/ATK-${{ github.ref_name }}-macos-unsigned.dmg