Merge pull request #1 from ardevd/workflow-refactor #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: scrcpy-build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: appimagecrafters/appimage-builder:latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up User | |
run: | | |
apt update | |
apt install -y sudo | |
echo "github ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
useradd -m github | |
usermod -aG sudo github | |
su - github | |
sudo apt -y install git wget curl jq unzip | |
sudo apt -y install build-essential | |
- name: Clone scrcpy | |
run: | | |
wget https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-linux.zip | |
unzip ninja-linux.zip | |
mkdir bin | |
mv ninja bin/. | |
echo "Ninja: $(which ninja)" | |
git clone https://github.com/Genymobile/scrcpy | |
cd scrcpy | |
# client build dependencies | |
# runtime dependencies | |
sudo apt install -y ffmpeg libsdl2-2.0-0 adb libusb-1.0-0 | |
# client build dependencies | |
sudo apt install -y gcc git pkg-config meson ninja-build libsdl2-dev \ | |
libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \ | |
libswresample-dev libusb-1.0-0-dev | |
# server build dependencies | |
sudo apt install -y openjdk-17-jdk python3-pip | |
pip3 install meson --user | |
- name: Build scrcpy | |
run: | | |
cd scrcpy | |
wget https://github.com/Genymobile/scrcpy/releases/download/v2.4/scrcpy-server-v2.4 -O scrcpy_server | |
~/.local/bin/meson x --buildtype release --strip -Db_lto=true \ | |
-Dprebuilt_server=./scrcpy_server | |
ninja -Cx | |
sudo ninja -Cx install | |
- name: Build AppImage | |
run: | | |
cd scrcpy | |
export APPIMAGE_EXTRACT_AND_RUN=1 | |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
chmod +x linuxdeploy*.AppImage | |
mkdir AppDir | |
export SRC_ROOT=$(realpath ..) | |
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/pulseaudio/:$LD_LIBRARY_PATH | |
./linuxdeploy*.AppImage -e /usr/local/bin/scrcpy --desktop-file $SRC_ROOT/scrcpy.desktop --icon-file $SRC_ROOT/scrcpy.png --appdir=AppDir --custom-apprun=$SRC_ROOT/AppRun --library=/usr/lib/x86_64-linux-gnu/libsndio.so.6.1 --library=/usr/lib/x86_64-linux-gnu/libicui18n.so.60 --library=/usr/lib/x86_64-linux-gnu/libicudata.so.60 --library=/usr/lib/x86_64-linux-gnu/libnettle.so.6 --library=/usr/lib/x86_64-linux-gnu/libhogweed.so.4 --library=/usr/lib/x86_64-linux-gnu/libicuuc.so.60 --library=/usr/lib/x86_64-linux-gnu/libcroco-0.6.so.3 --library=/usr/lib/x86_64-linux-gnu/libnuma.so.1 | |
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip | |
unzip platform-tools-latest-linux.zip | |
export ADB_DIR=$(realpath platform-tools) | |
export BUILD_DIR=$(realpath x) | |
cp $BUILD_DIR/app/scrcpy AppDir/usr/bin/. | |
cp $ADB_DIR/adb AppDir/usr/bin/. | |
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage | |
chmod +x appimagetool*.AppImage | |
mkdir -p AppDir/usr/local/share/scrcpy/ | |
cp scrcpy_server AppDir/usr/local/share/scrcpy/scrcpy-server | |
./appimagetool*.AppImage AppDir -n -u 'gh-releases-zsync|srevinsaju|scrcpy-appimage|continuous|scrcpy*.AppImage.zsync' scrcpy-$(git describe --tags)-$(uname -m).AppImage | |
mkdir dist | |
mv scrcpy*.AppImage* dist/ | |
- name: Upload AppImage Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: scrcpy-AppImage | |
path: scrcpy/dist/*.AppImage | |