Files
AynaLivePlayer/.github/workflows/build.yml
aynakeya e466e21bc8 fk
2024-05-23 18:27:04 +08:00

85 lines
2.8 KiB
YAML

name: Build
on: [push]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
executable_ext: ""
install_deps: sudo apt-get install -y libmpv-dev libgl-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libgl1-mesa-dev xorg-dev
- os: windows-latest
goos: windows
goarch: amd64
executable_ext: ".exe"
install_deps: |
curl -LO https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-mpv-0.38.0-1-any.pkg.tar.zst
curl -LO https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-v1.5.2-win64.zip
7z x zstd-v1.5.2-win64.zip -ozstd
.\zstd\zstd.exe -d mingw-w64-x86_64-mpv-0.38.0-1-any.pkg.tar.zst -o mingw-w64-x86_64-mpv-0.38.0-1-any.pkg.tar
7z x mingw-w64-x86_64-mpv-0.38.0-1-any.pkg.tar -oC:/msys64/mingw64
echo "CGO_CFLAGS=-IC:/msys64/mingw64/include" >> $GITHUB_ENV
echo "CGO_LDFLAGS=-LC:/msys64/mingw64/lib -lmpv" >> $GITHUB_ENV
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
EXECUTABLE_NAME: AynaLivePlayer
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Set up environment variables
run: |
echo "GOOS=${{ matrix.goos }}" >> $GITHUB_ENV
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
echo "EXECUTABLE=${EXECUTABLE_NAME}${{ matrix.executable_ext }}" >> $GITHUB_ENV
# - name: Install dependencies (Windows)
# if: matrix.goos == 'windows'
# uses: msys2/setup-msys2@v2
# with:
# msystem: MINGW64
# install: >-
# mingw-w64-x86_64-toolchain
# mingw-w64-x86_64-mpv
- name: Install dependencies
run: ${{ matrix.install_deps }}
- name: Install Fyne CLI
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Tidy go.mod
run: go mod tidy
- name: Bundle assets
run: |
fyne bundle --name resImageIcon --package resource ./assets/icon.png > ./resource/bundle.go
fyne bundle --append --name resFontMSYaHei --package resource ./assets/msyh0.ttf >> ./resource/bundle.go
fyne bundle --append --name resFontMSYaHeiBold --package resource ./assets/msyhbd0.ttf >> ./resource/bundle.go
- name: Build application
run: go build -o ./$EXECUTABLE app/main.go
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-build
path: ./${{ env.EXECUTABLE }}