Skip to content

Commit 969578f

Browse files
feat: linux builds (#531)
* chore: update dependencies * feat: create AppImage, deb and snap * ci: adjust PR workflow * fix: no desktop entry on .deb * build: fix snap has no icon * build: rpm * build: flatpak * ci: debug failure * ci: install flatpak * ci: add flathub remote * ci: add remote as user * docs: add flatpak documentation * docs: add more info * feat: adapt autoUpdater * cI: test vmaster * ci: fix wrong upload path for test * ci: fix file rename * ci: fix filename in url * build: fix filename * ci: change artifact names * ci: oopsi forgot about this * ci: finalize master workflow * ci: remaining workflows * cI: don't copy blockmap file * ci: fix asset upload url * cI: upload to r2 via rclone * ci: fix bucket missing * chore: temporarily test RC * ci: upload latest-linux.yml * chore: revert test changes * chore: remove unnecessary dependency that requires even more dependencies for the build to go through * docs: add changelog entry * chore: bump version * docs: add Linux mention to readme * docs: fix typos Co-authored-by: alepouna <98479040+alepouna@users.noreply.github.com> * ci: direct cdn upload * build: update flatpak freedesktop sdk * chore: reneame package from com.* to org.* * chore: change version * fix: two entries in windows installed programs due to different appId * fix: package names in workflows * refactor: improve workflows * refactor: variable referencing * feat: automatic path detection on linux * feat: hide simBridge start controls * docs: small wording change --------- Co-authored-by: alepouna <98479040+alepouna@users.noreply.github.com>
1 parent 4bdd5b7 commit 969578f

25 files changed

Lines changed: 9966 additions & 5757 deletions

.github/CHANGELOG.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010

1111
releases:
12+
- name: 3.7.0
13+
changes:
14+
- title: Add Linux compatibility
15+
categories: [Core]
16+
authors: [FoxtotSierra]
1217
- name: 3.6.0
1318
changes:
1419
- title: Add Quality Assurance functionality

.github/workflows/master.yaml

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ jobs:
1111
env:
1212
MASTER_PRE_RELEASE_ID: 36189658
1313
MASTER_PRE_RELEASE_TAG: vmaster
14-
ASSET_PATH: dist/FlyByWire_Installer_Setup.exe
15-
ASSET_NAME: FlyByWire_Installer_Setup.exe
14+
PACKAGE_NAME: FlyByWire-Installer
1615
steps:
1716
- name: Checkout source
1817
uses: actions/checkout@v4
@@ -33,12 +32,28 @@ jobs:
3332
sudo apt-get update
3433
sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386
3534
sudo apt-get install -y wine32 wine64
35+
sudo apt-get install -y flatpak
36+
sudo apt-get install -y flatpak-builder
3637
sudo apt-get install -y rclone
37-
38+
- name: Add Flathub Flatpak remote
39+
run: flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
3840
- name: Package installer
3941
run: |
40-
npm run package && rm -rf ./dist/win-unpacked/
41-
42+
npm run package:all
43+
mkdir -p upload/
44+
# Copy and modify latest.yml to use static filenames
45+
sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/g" ./dist/latest.yml > ./upload/latest.yml
46+
# Copy and modify latest-linux.yml to use static filenames
47+
sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/g" ./dist/latest-linux.yml > ./upload/latest-linux.yml
48+
for file in ./dist/${{ env.PACKAGE_NAME }}-*-*.*; do
49+
[ -e "$file" ] || continue
50+
filename=$(basename "$file")
51+
52+
# Remove version from filename to create static filename
53+
staticname=$(echo "$filename" | sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/")
54+
55+
cp "$file" "./upload/$staticname"
56+
done
4257
- name: Configure rclone for Cloudflare R2
4358
run: |
4459
mkdir -p ~/.config/rclone
@@ -57,39 +72,43 @@ jobs:
5772
env:
5873
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
5974
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
60-
run: ./scripts/cdn-cf.sh dist/ installer/dev
75+
run: ./scripts/cdn-cf.sh upload/ installer/dev
6176

62-
- name: Get and delete master pre-release zip asset
77+
- name: Delete previous assets from master pre-release
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6380
run: |
64-
echo 'checking for first release asset...'
65-
assets=$( \
66-
curl --location --request GET \
67-
--url https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}/assets
68-
)
69-
if [ $(echo $assets | jq '.[0].size') -eq '0' ]; then
70-
echo 'no asset to delete'
71-
else
72-
assetId=$(echo $assets | jq '.[0].id')
73-
echo 'deleting asset '$assetId
81+
echo 'Fetching all release assets...'
82+
assets=$(curl --location --request GET \
83+
--url https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}/assets \
84+
--header "authorization: Bearer $GITHUB_TOKEN")
85+
asset_ids=$(echo "$assets" | jq '.[].id')
86+
for id in $asset_ids; do
87+
echo "Deleting asset $id"
7488
curl --request DELETE \
75-
--url https://api.github.com/repos/${{ github.repository }}/releases/assets/$assetId \
76-
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'
77-
fi
78-
- name: Upload release binary
79-
uses: actions/upload-release-asset@v1.0.2
89+
--url https://api.github.com/repos/${{ github.repository }}/releases/assets/$id \
90+
--header "authorization: Bearer $GITHUB_TOKEN"
91+
done
92+
- name: Upload binaries to GitHub pre-release assets
8093
env:
81-
GITHUB_TOKEN: ${{ github.token }}
82-
with:
83-
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}/assets{?name,label}
84-
asset_path: ${{ env.ASSET_PATH }}
85-
asset_name: ${{ env.ASSET_NAME }}
86-
asset_content_type: application/x-msdos-program
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
run: |
96+
for file in upload/*; do
97+
[ -e "$file" ] || continue
98+
name=$(basename "$file")
99+
echo "Uploading $name"
100+
curl --request POST \
101+
--url "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}/assets?name=$name" \
102+
--header "authorization: Bearer $GITHUB_TOKEN" \
103+
--header "Content-Type: application/octet-stream" \
104+
--data-binary @"$file"
105+
done
87106
- name: Update master pre-release body
88107
run: |
89108
curl --request PATCH \
90109
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MASTER_PRE_RELEASE_ID }}' \
91110
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
92111
--header 'Content-Type: application/json' \
93112
--data-raw '{
94-
"body": "This pre-release has its ${{ env.ASSET_NAME }} asset updated on every commit to the master branch\nDo not use the source code assets, they are never updated\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\nThis link will always point to the latest master build: https://github.com/${{ github.repository }}/releases/download/${{ env.MASTER_PRE_RELEASE_TAG }}/${{ env.ASSET_NAME }}"
113+
"body": "This pre-release has its assets updated on every commit to the master branch\nDo not use the source code assets, they are never updated\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\n\nThis link will always point to the latest Windows master build: https://github.com/${{ github.repository }}/releases/download/${{ env.MASTER_PRE_RELEASE_TAG }}/${{ env.PACKAGE_NAME }}-x64.exe"
95114
}'

.github/workflows/pr.yaml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,44 @@ jobs:
4343
- name: Install dependencies
4444
run: npm ci
4545
- name: Install system requirements
46-
run: sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386 && sudo apt-get install -y wine32 wine64
46+
run: |
47+
sudo dpkg --add-architecture i386
48+
sudo apt-get update
49+
sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386
50+
sudo apt-get install -y wine32 wine64
51+
sudo apt-get install -y flatpak
52+
sudo apt-get install -y flatpak-builder
53+
- name: Add Flathub Flatpak remote
54+
run: flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
4755
- name: Build Installer
48-
run: npm run package
49-
- name: Upload PR artifact
56+
run: npm run package:all
57+
- name: Upload PR artifact (.exe)
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: FlyByWire-Installer-exe
61+
path: ./dist/*.exe
62+
- name: Upload PR artifact (.AppImage)
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: FlyByWire-Installer-AppImage
66+
path: ./dist/*.AppImage
67+
- name: Upload PR artifact (.rpm)
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: FlyByWire-Installer-rpm
71+
path: ./dist/*.rpm
72+
- name: Upload PR artifact (.deb)
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: FlyByWire-Installer-deb
76+
path: ./dist/*.deb
77+
- name: Upload PR artifact (.snap)
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: FlyByWire-Installer-snap
81+
path: ./dist/*.snap
82+
- name: Upload PR artifact (.flatpak)
5083
uses: actions/upload-artifact@v4
5184
with:
52-
name: FlyByWire_Installer_Setup
53-
path: ./dist/FlyByWire_Installer_Setup.exe
85+
name: FlyByWire-Installer-flatpak
86+
path: ./dist/*.flatpak

.github/workflows/pre-release.yaml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ jobs:
99
name: Upload Release Asset
1010
runs-on: ubuntu-22.04
1111
env:
12-
ASSET_PATH: dist/FlyByWire_Installer_Setup.exe
13-
ASSET_DIRECTORY: dist/
14-
ASSET_NAME: FlyByWire_Installer_Setup.exe
12+
PACKAGE_NAME: FlyByWire-Installer
1513
steps:
1614
- uses: actions/checkout@v4
1715
- uses: actions/setup-node@v4
@@ -31,12 +29,33 @@ jobs:
3129
sudo apt-get update
3230
sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386
3331
sudo apt-get install -y wine32 wine64
32+
sudo apt-get install -y flatpak
33+
sudo apt-get install -y flatpak-builder
3434
sudo apt-get install -y rclone
35+
- name: Add Flathub Flatpak remote
36+
run: flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
3537

3638
- name: Package installer
3739
run: |
38-
npm run package && rm -rf ./dist/win-unpacked/
39-
40+
npm run package:all
41+
mkdir -p upload/github/
42+
cp ./dist/latest.yml ./upload/github/
43+
cp ./dist/latest-linux.yml ./upload/github/
44+
cp ./dist/${{ env.PACKAGE_NAME }}-*-*.* ./upload/github/ || true
45+
mkdir -p upload/cdn/
46+
# Copy and modify latest.yml to use static filenames
47+
sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/g" ./dist/latest.yml > ./upload/cdn/latest.yml
48+
# Copy and modify latest-linux.yml to use static filenames
49+
sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/g" ./dist/latest-linux.yml > ./upload/cdn/latest-linux.yml
50+
for file in ./dist/${{ env.PACKAGE_NAME }}-*-*.*; do
51+
[ -e "$file" ] || continue
52+
filename=$(basename "$file")
53+
54+
# Remove version from filename to create static filename
55+
staticname=$(echo "$filename" | sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/")
56+
57+
cp "$file" "./upload/cdn/$staticname"
58+
done
4059
- name: Configure rclone for Cloudflare R2
4160
run: |
4261
mkdir -p ~/.config/rclone
@@ -55,7 +74,7 @@ jobs:
5574
env:
5675
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
5776
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
58-
run: ./scripts/cdn-cf.sh dist/ installer/rc
77+
run: ./scripts/cdn-cf.sh upload/cdn/ installer/rc
5978

6079
- name: Create Release
6180
id: create_release
@@ -68,13 +87,19 @@ jobs:
6887
draft: false
6988
prerelease: true
7089

71-
- name: Upload Release Asset
72-
id: upload-release-asset
73-
uses: actions/upload-release-asset@v1
90+
- name: Upload all release assets
7491
env:
7592
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
with:
77-
upload_url: ${{ steps.create_release.outputs.upload_url }}
78-
asset_path: ${{ env.ASSET_PATH }}
79-
asset_name: ${{ env.ASSET_NAME }}
80-
asset_content_type: application/x-msdos-program
93+
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
94+
run: |
95+
base_url="${UPLOAD_URL%\{*}"
96+
for file in upload/github/*; do
97+
[ -e "$file" ] || continue
98+
name=$(basename "$file")
99+
echo "Uploading $name"
100+
curl --request POST \
101+
--url "$base_url?name=$name" \
102+
--header "authorization: Bearer $GITHUB_TOKEN" \
103+
--header "Content-Type: application/octet-stream" \
104+
--data-binary @"$file"
105+
done

.github/workflows/release.yaml

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ jobs:
1111
name: Upload Release Asset
1212
runs-on: ubuntu-22.04
1313
env:
14-
ASSET_PATH: dist/FlyByWire_Installer_Setup.exe
15-
ASSET_DIRECTORY: dist/
16-
ASSET_NAME: FlyByWire_Installer_Setup.exe
14+
PACKAGE_NAME: FlyByWire-Installer
1715
steps:
1816
- uses: actions/checkout@v4
1917
- uses: actions/setup-node@v4
@@ -33,12 +31,33 @@ jobs:
3331
sudo apt-get update
3432
sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386
3533
sudo apt-get install -y wine32 wine64
34+
sudo apt-get install -y flatpak
35+
sudo apt-get install -y flatpak-builder
3636
sudo apt-get install -y rclone
37+
- name: Add Flathub Flatpak remote
38+
run: flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
3739

3840
- name: Package installer
3941
run: |
40-
npm run package && rm -rf ./dist/win-unpacked/
41-
42+
npm run package:all
43+
mkdir -p upload/github/
44+
cp ./dist/latest.yml ./upload/github/
45+
cp ./dist/latest-linux.yml ./upload/github/
46+
cp ./dist/${{ env.PACKAGE_NAME }}-*-*.* ./upload/github/ || true
47+
mkdir -p upload/cdn/
48+
# Copy and modify latest.yml to use static filenames
49+
sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/g" ./dist/latest.yml > ./upload/cdn/latest.yml
50+
# Copy and modify latest-linux.yml to use static filenames
51+
sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/g" ./dist/latest-linux.yml > ./upload/cdn/latest-linux.yml
52+
for file in ./dist/${{ env.PACKAGE_NAME }}-*-*.*; do
53+
[ -e "$file" ] || continue
54+
filename=$(basename "$file")
55+
56+
# Remove version from filename to create static filename
57+
staticname=$(echo "$filename" | sed -E "s/${{ env.PACKAGE_NAME }}-[0-9]+\.[0-9]+\.[0-9]+(-[^-]+)?-/${{ env.PACKAGE_NAME }}-/")
58+
59+
cp "$file" "./upload/cdn/$staticname"
60+
done
4261
- name: Configure rclone for Cloudflare R2
4362
run: |
4463
mkdir -p ~/.config/rclone
@@ -58,8 +77,8 @@ jobs:
5877
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
5978
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
6079
run: |
61-
./scripts/cdn-cf.sh dist/ installer/release
62-
./scripts/cdn-cf.sh dist/ installer/rc
80+
./scripts/cdn-cf.sh upload/cdn/ installer/release
81+
./scripts/cdn-cf.sh upload/cdn/ installer/rc
6382
6483
- name: Create Release
6584
id: create_release
@@ -72,13 +91,19 @@ jobs:
7291
draft: false
7392
prerelease: false
7493

75-
- name: Upload Release Asset
76-
id: upload-release-asset
77-
uses: actions/upload-release-asset@v1
94+
- name: Upload all release assets
7895
env:
7996
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80-
with:
81-
upload_url: ${{ steps.create_release.outputs.upload_url }}
82-
asset_path: ${{ env.ASSET_PATH }}
83-
asset_name: ${{ env.ASSET_NAME }}
84-
asset_content_type: application/x-msdos-program
97+
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
98+
run: |
99+
base_url="${UPLOAD_URL%\{*}"
100+
for file in upload/github/*; do
101+
[ -e "$file" ] || continue
102+
name=$(basename "$file")
103+
echo "Uploading $name"
104+
curl --request POST \
105+
--url "$base_url?name=$name" \
106+
--header "authorization: Bearer $GITHUB_TOKEN" \
107+
--header "Content-Type: application/octet-stream" \
108+
--data-binary @"$file"
109+
done

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository contains the installer for FlyByWire Simulations projects such a
77

88
## How to contribute
99

10-
The installer is built as an [Electron Application](https://www.electronjs.org/) for Windows
10+
The installer is built as an [Electron Application](https://www.electronjs.org/) for Windows and Linux
1111
using [TypeScript](https://www.typescriptlang.org/) and [React](https://reactjs.org/).
1212

1313
### Requirements
@@ -17,6 +17,16 @@ Please make sure you have:
1717
- [git](https://git-scm.com/downloads)
1818
- [NodeJS 20](https://nodejs.org/en/)
1919

20+
If you want to build flatpaks (package:flatpak, package:linux, package:all) you will also need to install the following from your preferred package manager:
21+
22+
- [flatpak](https://flatpak.org/)
23+
- [flatpak-builder](https://docs.flatpak.org/en/latest/building-introduction.html)
24+
25+
After installing flatpak add the flathub remote:
26+
27+
```shell script
28+
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
29+
```
2030
### Get started
2131

2232
First fork the project and install the dependencies
@@ -31,12 +41,25 @@ Then run the development server using
3141
npm run dev
3242
```
3343

34-
To build the package as .exe, run
44+
To build the package as an executable application, run
3545

3646
```shell script
3747
npm run package
3848
```
3949

40-
Packaged applications will automatically update if there is a newer version available (compared to build version in package.json), this does
50+
On Windows this will build an .exe file, on Linux it will build as .AppImage, .deb and .rpm. If you wish to target specific ways of distribution, you may instead run:
51+
52+
```shell
53+
npm run package:all # packages for all targets
54+
npm run package:win # packages for windows (.exe)
55+
npm run package:linux # packages for all linux targets (.AppImage,.deb,.rpm,.flatpak and .snap)
56+
npm run package:appimage # packages as .AppImage
57+
npm run package:deb # packages as .deb
58+
npm run package:rpm # packages as .rpm
59+
npm run package:snap # packages as .snap
60+
npm run package:flatpak # packages as .flatpak
61+
```
62+
63+
Packaged applications (.exe and .AppImage only) will automatically update if there is a newer version available (compared to build version in package.json). On windows, this does
4164
also apply to development versions (ending on -devXX), which are updated via a separate stream. Updates are distributed once the build
4265
version is changed and a tag has been added.
3.43 KB
Loading
895 Bytes
Loading
7.59 KB
Loading
1.32 KB
Loading

0 commit comments

Comments
 (0)