Skip to content

Commit

Permalink
Create Build-Fyne-App.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsxm authored Dec 7, 2024
1 parent 3570eb6 commit 839ffab
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/Build-Fyne-App.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build Fyne App

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18' # 或者你需要的 Go 版本

- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev xorg-dev libgtk-3-dev libappindicator3-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew update
brew install go
brew install pkg-config
- name: Install Fyne
run: go get fyne.io/fyne/v2/...

- name: Build app
run: go build -o myapp

- name: Package app (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
fyne package -os linux -icon myicon.png
mv myapp-linux.tar.xz myapp-linux-${{ github.sha }}.tar.xz
- name: Package app (macOS)
if: matrix.os == 'macOS-latest'
run: |
fyne package -os darwin -icon myicon.png -name "MyApp" -appID com.example.myapp
mv MyApp.app.zip myapp-darwin-${{ github.sha }}.zip
- name: Package app (Windows)
if: matrix.os == 'windows-latest'
run: |
fyne package -os windows -icon myicon.ico
Compress-Archive -Path myapp.exe -DestinationPath myapp-windows-${{ github.sha }}.zip
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-build
path: |
myapp-linux-*.tar.xz
myapp-darwin-*.zip
myapp-windows-*.zip

0 comments on commit 839ffab

Please sign in to comment.