PlayerLink/.github/workflows/build.yml

180 lines
4.9 KiB
YAML
Raw Normal View History

2025-01-12 13:33:28 +01:00
name: Build and Package AppImage, Windows Executable, and macOS DMG
2025-01-12 11:41:06 +01:00
on:
push:
branches:
- main
2025-01-12 15:02:15 +01:00
tags:
- 'v*'
2025-01-12 11:41:06 +01:00
pull_request:
jobs:
2025-01-12 13:22:02 +01:00
build-linux:
runs-on: ubuntu-20.04
2025-01-12 11:41:06 +01:00
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.22.0'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libssl-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
zlib1g-dev \
libglu1-mesa-dev \
libgtk-3-dev \
libwayland-dev \
fuse
sudo modprobe fuse
- name: Configure with CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build the project
run: cmake --build build --config Release
- name: Download linuxdeploy
run: |
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
chmod +x linuxdeploy-x86_64.AppImage linuxdeploy-plugin-gtk.sh
2025-01-12 11:41:06 +01:00
sudo mv linuxdeploy-x86_64.AppImage /usr/local/bin/linuxdeploy
- name: Create AppImage
run: |
cp -r build/PlayerLink linux/AppDir/usr/bin/
linuxdeploy --appdir=linux/AppDir --plugin gtk --output appimage
2025-01-12 11:41:06 +01:00
- name: Upload AppImage artifact
2025-01-12 13:22:02 +01:00
uses: actions/upload-artifact@v4
2025-01-12 11:41:06 +01:00
with:
name: PlayerLink-AppImage
path: ./*.AppImage
2025-01-12 13:22:02 +01:00
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.22.0'
- name: Configure with CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build the project
run: cmake --build build --config Release
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: PlayerLink-Windows-Executable
path: build/Release/*
2025-01-12 13:33:28 +01:00
build-macos:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.22.0'
- name: Configure with CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build the project
run: cmake --build build --config Release
- name: Create DMG package
run: |
mkdir -p dmg/PlayerLink
cp -r build/PlayerLink.app dmg/PlayerLink/
hdiutil create -volname "PlayerLink" -srcfolder dmg/PlayerLink -ov -format UDZO PlayerLink.dmg
- name: Upload macOS DMG artifact
uses: actions/upload-artifact@v4
with:
name: PlayerLink-macOS-DMG
path: PlayerLink.dmg
2025-01-12 15:02:15 +01:00
create-release:
if: startsWith(github.ref, 'refs/tags/')
2025-01-12 15:02:15 +01:00
needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-latest
2025-01-12 15:02:15 +01:00
steps:
- name: Download artifacts
2025-01-12 15:02:15 +01:00
uses: actions/download-artifact@v4
with:
path: ./release-assets
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R ./release-assets
2025-01-12 15:02:15 +01:00
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2025-01-12 15:02:15 +01:00
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Upload AppImage
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/PlayerLink-x86_64.AppImage
asset_name: PlayerLink-x86_64.AppImage
asset_content_type: application/octet-stream
- name: Upload Windows Executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/PlayerLink.exe
asset_name: PlayerLink.exe
asset_content_type: application/octet-stream
- name: Upload macOS DMG
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/PlayerLink.dmg
asset_name: PlayerLink.dmg
asset_content_type: application/octet-stream