Skip to content

Commit

Permalink
修改Linux构建使用AppImage
Browse files Browse the repository at this point in the history
  • Loading branch information
auqhjjqdo committed Mar 14, 2023
1 parent c473e61 commit 71463a2
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 20 deletions.
51 changes: 32 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
push:
paths-ignore:
- "README.md"
- 'README.md'
tags:
- "v*"
- 'v*'

jobs:
desktop-build:
Expand All @@ -18,15 +18,20 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Install Dependencies
run: |
pip3 install --upgrade pip setuptools
pip3 install pyinstaller
pip3 install -r requirements.txt
- name: Pyinstaller Build
run: |
pyinstaller main.spec --distpath .
run: pyinstaller build/main.spec --distpath .

- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -60,27 +65,35 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Install Dependencies
run: |
sudo add-apt-repository universe
sudo apt install libfuse2
wget -q -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
chmod +x appimage-builder-x86_64.AppImage
pip3 install wheel
- name: Amd64 Build
if: ${{ matrix.arch == 'amd64' }}
# uses: AppImageCrafters/build-appimage@master
# with:
# recipe: build/AppImageBuilder_amd64.yml
run: |
pip3 install --upgrade pip setuptools
pip3 install pyinstaller staticx
pip3 install -r requirements.txt
pyinstaller main.spec
staticx dist/LiveRecorder LiveRecorder
./appimage-builder-x86_64.AppImage --recipe build/AppImageBuilder_amd64.yml
- name: Arm64 Build
if: ${{ matrix.arch == 'arm64' }}
uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest
copy_artifact_path: LiveRecorder
commands: |
sudo apt install python3-pip -y
pip3 install --upgrade pip setuptools
pip3 install pyinstaller
pip3 install -r requirements.txt
pyinstaller main.spec --distpath .
# uses: AppImageCrafters/build-appimage@master
# with:
# recipe: build/AppImageBuilder_arm64.yml
run: |
./appimage-builder-x86_64.AppImage --recipe build/AppImageBuilder_arm64.yml
- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand Down
36 changes: 36 additions & 0 deletions build/AppImageBuilder_amd64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 1
script:
# - which mksquashfs || apt install squashfs-tools
- rm -rf AppDir | true
- rm -rf appimage-build | true
- mkdir -p AppDir/usr/src
- cp main.py AppDir/usr/src
- mkdir -p AppDir/usr/share/icons
- cp build/bambino.png AppDir/usr/share/icons
- python3.10 -m pip install --ignore-installed --prefix=/usr --root=AppDir -r requirements.txt

AppDir:
path: ./AppDir
app_info:
id: LiveRecorder
name: LiveRecorder
icon: bambino
version: Linux
exec: usr/bin/python3.10
exec_args: '$APPDIR/usr/src/main.py $@'

apt:
arch: amd64
sources:
- sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse'
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920d1991bc93c'
include:
- python3

runtime:
env:
PYTHONHOME: '${APPDIR}/usr'
PYTHONPATH: '${APPDIR}/usr/lib/python3.10/site-packages'

AppImage:
arch: x86_64
36 changes: 36 additions & 0 deletions build/AppImageBuilder_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 1
script:
# - which mksquashfs || apt install squashfs-tools
- rm -rf AppDir | true
- rm -rf appimage-build | true
- mkdir -p AppDir/usr/src
- cp main.py AppDir/usr/src
- mkdir -p AppDir/usr/share/icons
- cp build/bambino.png AppDir/usr/share/icons
- python3.10 -m pip install --ignore-installed --prefix=/usr --root=AppDir -r requirements.txt

AppDir:
path: ./AppDir
app_info:
id: LiveRecorder
name: LiveRecorder
icon: bambino
version: Linux
exec: usr/bin/python3.10
exec_args: '$APPDIR/usr/src/main.py $@'

apt:
arch: arm64
sources:
- sourceline: 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse'
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920d1991bc93c'
include:
- python3

runtime:
env:
PYTHONHOME: '${APPDIR}/usr'
PYTHONPATH: '${APPDIR}/usr/lib/python3.10/site-packages'

AppImage:
arch: aarch64
File renamed without changes.
Binary file added build/bambino.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion main.spec → build/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ block_cipher = None


a = Analysis(
['main.py'],
['../main.py'],
pathex=[],
binaries=[],
datas=collect_data_files('streamlink.plugins', include_py_files=True),
Expand Down

0 comments on commit 71463a2

Please sign in to comment.