Skip to content

Commit 82bf7ff

Browse files
committed
ci: build AppImage with linuxdeploy
1 parent 7f47e6c commit 82bf7ff

File tree

4 files changed

+21
-133
lines changed

4 files changed

+21
-133
lines changed

.github/workflows/linux.yml

Lines changed: 19 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ jobs:
8585
chmod +x AppDir/saber
8686
8787
install -Dm644 flatpak/com.adilhanney.saber.metainfo.xml -t AppDir/share/metainfo/
88-
install -Dm644 flatpak/com.adilhanney.saber.metainfo.xml -t AppDir/usr/share/metainfo/
89-
9088
install -Dm644 assets/icon/icon_linux.svg AppDir/share/icons/hicolor/scalable/apps/com.adilhanney.saber.svg
91-
install -Dm644 assets/icon/icon_linux.svg AppDir/usr/share/icons/hicolor/scalable/apps/com.adilhanney.saber.svg
92-
9389
install -Dm644 flatpak/com.adilhanney.saber.desktop -t AppDir/share/applications/
9490
9591
tar -C AppDir -czvf $archiveName .
@@ -118,7 +114,8 @@ jobs:
118114
- name: Checkout code
119115
uses: actions/checkout@v6
120116

121-
- name: Install AppImage dependencies
117+
- uses: "./.github/shared_workflows/install_apt_dependencies"
118+
- name: Install FUSE
122119
run: |
123120
sudo add-apt-repository universe
124121
sudo apt install libfuse2
@@ -127,32 +124,29 @@ jobs:
127124
uses: actions/download-artifact@v7
128125
with:
129126
name: Saber-Archive-x86_64
130-
131-
- name: Rename app archive
127+
- name: Extract app archive
132128
run: |
133-
mv Saber_*.tar.gz Saber-Linux-Portable.tar.gz
134-
135-
- name: Install appimage-builder
136-
run: |
137-
sudo pip3 install --ignore-installed git+https://github.com/AppImageCrafters/appimage-builder.git
138-
139-
- name: Prepare build files
140-
working-directory: appimage
129+
mkdir -p linux/AppImage/AppDir/usr/bin
130+
tar -xzvf Saber*.tar.gz -C linux/AppImage/AppDir/usr/bin
131+
- name: Prepare AppDir
132+
working-directory: linux/AppImage/AppDir
141133
run: |
142-
mkdir AppDir
143-
tar -xzvf ../Saber-Linux-Portable.tar.gz -C AppDir
134+
mkdir -p usr/share
135+
cp -R usr/bin/share/* usr/share/
136+
rm -rf usr/bin/share
137+
echo "LD_LIBRARY_PATH=$(pwd)/usr/bin/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
144138
145-
- name: Set AppImage version
146-
working-directory: appimage
139+
- name: Install linuxdeploy
140+
working-directory: linux/AppImage
147141
run: |
148-
# replace line with "version: latest" with "version: $buildName"
149-
buildName=$(grep -oP "(?<=buildName = ').*(?=')" ../lib/data/version.dart)
150-
sed -i "s/version: latest/version: ${buildName}/" AppImageBuilder.yml
151-
142+
wget https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-x86_64.AppImage
143+
chmod +x linuxdeploy-x86_64.AppImage
152144
- name: Build AppImage
153-
working-directory: appimage
145+
working-directory: linux/AppImage
154146
run: |
155-
appimage-builder --skip-test
147+
./linuxdeploy-x86_64.AppImage --appdir AppDir
148+
149+
- run: tree linux/AppImage
156150

157151
- name: Upload artifact
158152
uses: actions/upload-artifact@v6
@@ -167,42 +161,3 @@ jobs:
167161
repo_token: ${{ secrets.GITHUB_TOKEN }}
168162
file: appimage/Saber-*-x86_64.AppImage*
169163
file_glob: true
170-
171-
build-flatpak:
172-
name: Build Flatpak
173-
needs: build-linux
174-
runs-on: ubuntu-latest
175-
timeout-minutes: 15
176-
container:
177-
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
178-
options: --privileged
179-
steps:
180-
- name: Checkout flathub repo
181-
uses: actions/checkout@v6
182-
with:
183-
repository: flathub/com.adilhanney.saber
184-
submodules: recursive
185-
186-
- name: Download app archive
187-
uses: actions/download-artifact@v7
188-
with:
189-
name: Saber-Archive-x86_64
190-
191-
- name: Rename app archive
192-
run: |
193-
mv Saber_*.tar.gz Saber_snapshot.tar.gz
194-
195-
- name: Patch manifest to use local archive
196-
run: |
197-
# Add --no-same-owner to tar in build-commands
198-
jq '.modules? |= map(if type=="object" and .name=="saber" then .["build-commands"] |= map(if type=="string" then sub("tar -xf "; "tar --no-same-owner -xf ") else . end) else . end)' com.adilhanney.saber.json > tmp.json && mv tmp.json com.adilhanney.saber.json
199-
200-
# Replace sources with local archive
201-
jq '.modules[]? |= if type=="object" and .name=="saber" then .sources = [ {"type":"file","path":"./Saber_snapshot.tar.gz"} ] else . end' com.adilhanney.saber.json > tmp.json && mv tmp.json com.adilhanney.saber.json
202-
203-
- name: Build Flatpak
204-
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
205-
with:
206-
bundle: Saber_snapshot.flatpak
207-
manifest-path: com.adilhanney.saber.json
208-
upload-artifact: true

appimage/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

appimage/AppImageBuilder.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

linux/AppImage/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AppDir
2+
linuxdeploy-*.AppImage

0 commit comments

Comments
 (0)