Skip to content

Commit 011ccd4

Browse files
committed
initial
0 parents  commit 011ccd4

12 files changed

Lines changed: 3374 additions & 0 deletions

‎.envrc‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# shellsheck shell=bash
2+
set -euo pipefail
3+
4+
if ! has nix_direnv_version || ! nix_direnv_version 3.0.7; then
5+
source_url https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.7/direnvrc sha256-bn8WANE5a91RusFmRI7kS751ApelG02nMcwRekC/qzc=
6+
fi
7+
use flake . --accept-flake-config
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
name: Build Flatpak
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
env:
15+
FLATPAK_ID: com.onclebob.Bob
16+
17+
jobs:
18+
build:
19+
name: Build Flatpak (${{ matrix.arch }})
20+
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
21+
strategy:
22+
matrix:
23+
arch: [x86_64, aarch64]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install flatpak-builder
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y flatpak flatpak-builder
33+
34+
- name: Add Flathub repository
35+
run: |
36+
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
37+
38+
- name: Install Flatpak SDK and runtime
39+
run: |
40+
sudo flatpak install -y flathub org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08
41+
sudo flatpak install -y flathub org.freedesktop.Sdk.Extension.llvm21//25.08
42+
43+
- name: Build Flatpak
44+
run: |
45+
flatpak-builder --arch=${{ matrix.arch }} \
46+
--repo=repo \
47+
--force-clean \
48+
--ccache \
49+
--install-deps-from=flathub \
50+
build-dir \
51+
${{ env.FLATPAK_ID }}.yml
52+
53+
- name: Create Flatpak bundle
54+
run: |
55+
flatpak build-bundle repo \
56+
${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak \
57+
${{ env.FLATPAK_ID }} \
58+
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
59+
60+
- name: Import GPG key
61+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
62+
env:
63+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
64+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
65+
run: |
66+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
67+
echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf
68+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
69+
gpg-connect-agent reloadagent /bye
70+
71+
- name: Sign Flatpak bundle
72+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
73+
env:
74+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
75+
run: |
76+
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2 | head -n1)
77+
echo "$GPG_PASSPHRASE" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 \
78+
--detach-sign --armor \
79+
--output ${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak.sig \
80+
${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak
81+
82+
- name: Generate checksums
83+
run: |
84+
sha256sum ${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak > ${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak.sha256
85+
86+
- name: Upload build artifacts
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: flatpak-${{ matrix.arch }}
90+
path: |
91+
${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak
92+
${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak.sig
93+
${{ env.FLATPAK_ID }}-${{ matrix.arch }}.flatpak.sha256
94+
retention-days: 30
95+
96+
- name: Upload OSTree repository
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: ostree-repo-${{ matrix.arch }}
100+
path: repo/
101+
retention-days: 7
102+
103+
release:
104+
name: Create Release
105+
needs: build
106+
runs-on: ubuntu-latest
107+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
108+
109+
steps:
110+
- name: Download all artifacts
111+
uses: actions/download-artifact@v4
112+
with:
113+
path: artifacts
114+
115+
- name: Prepare release assets
116+
run: |
117+
mkdir -p release
118+
find artifacts -name "*.flatpak" -exec cp {} release/ \;
119+
find artifacts -name "*.flatpak.sig" -exec cp {} release/ \;
120+
find artifacts -name "*.flatpak.sha256" -exec cp {} release/ \;
121+
ls -lah release/
122+
123+
- name: Create GitHub Release
124+
uses: softprops/action-gh-release@v1
125+
with:
126+
files: release/*
127+
draft: false
128+
prerelease: false
129+
generate_release_notes: true
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
133+
publish-repo:
134+
name: Publish OSTree Repository
135+
needs: build
136+
runs-on: ubuntu-latest
137+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
138+
139+
steps:
140+
- name: Download OSTree repositories
141+
uses: actions/download-artifact@v4
142+
with:
143+
pattern: ostree-repo-*
144+
path: repos
145+
146+
- name: Merge OSTree repositories
147+
run: |
148+
sudo apt-get update
149+
sudo apt-get install -y ostree
150+
ostree init --repo=merged-repo --mode=archive-z2
151+
152+
for repo in repos/ostree-repo-*/; do
153+
if [ -d "$repo" ]; then
154+
ostree pull-local --repo=merged-repo "$repo"
155+
fi
156+
done
157+
158+
- name: Import GPG key for repo signing
159+
env:
160+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
161+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
162+
run: |
163+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
164+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
165+
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2 | head -n1)
166+
echo "GPG_KEY_ID=$GPG_KEY_ID" >> $GITHUB_ENV
167+
168+
- name: Sign OSTree repository
169+
env:
170+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
171+
run: |
172+
echo "$GPG_PASSPHRASE" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign /dev/null 2>/dev/null || true
173+
ostree summary --repo=merged-repo --update --gpg-sign=${{ env.GPG_KEY_ID }} --gpg-homedir=$HOME/.gnupg
174+
175+
- name: Deploy to GitHub Pages
176+
uses: peaceiris/actions-gh-pages@v3
177+
with:
178+
github_token: ${{ secrets.GITHUB_TOKEN }}
179+
publish_dir: ./merged-repo
180+
publish_branch: gh-pages
181+
force_orphan: true

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.direnv/
2+

‎Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
all:
2+
flatpak-builder build --user --install-deps-from=flathub --gpg-sign=${GPG_KEY_ID} --disable-rofiles-fuse --disable-updates --force-clean --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}

‎com.onclebob.Bob.yml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Generated from flatpak-flutter.yml, do not edit
2+
# Visit the flatpak-flutter project at https://github.com/TheAppgineer/flatpak-flutter
3+
app-id: com.onclebob.Bob
4+
runtime: org.freedesktop.Platform
5+
runtime-version: '25.08'
6+
sdk: org.freedesktop.Sdk
7+
sdk-extensions:
8+
- org.freedesktop.Sdk.Extension.llvm21
9+
command: com.onclebob.Bob
10+
finish-args:
11+
- --share=ipc
12+
- --share=network
13+
- --filesystem=host
14+
- --socket=wayland
15+
- --socket=fallback-x11
16+
- --device=dri
17+
modules:
18+
- name: Bob
19+
buildsystem: simple
20+
build-options:
21+
arch:
22+
x86_64:
23+
env:
24+
BUNDLE_PATH: build/linux/x64/release/bundle
25+
aarch64:
26+
env:
27+
BUNDLE_PATH: build/linux/arm64/release/bundle
28+
append-path: /usr/lib/sdk/llvm21/bin:/var/lib/flutter/bin
29+
prepend-ld-library-path: /usr/lib/sdk/llvm21/lib
30+
env:
31+
PUB_CACHE: /run/build/Bob/.pub-cache
32+
build-commands:
33+
- setup-flutter.sh -C .
34+
- flutter build linux --release --no-pub
35+
- install -D $BUNDLE_PATH/bob /app/bin/com.onclebob.Bob
36+
- cp -r $BUNDLE_PATH/lib /app/bin/lib
37+
- cp -r $BUNDLE_PATH/data /app/bin/data
38+
- install -Dm644 linux/com.onclebob.Bob.png /app/share/icons/hicolor/512x512/apps/com.onclebob.Bob.png
39+
- install -Dm644 linux/com.onclebob.Bob.desktop /app/share/applications/com.onclebob.Bob.desktop
40+
sources:
41+
- pubspec-sources.json
42+
- type: git
43+
url: https://github.com/xmit-co/bob.git
44+
tag: v0.0.2-flatpak
45+
commit: 9de570d132aedbcf4f86c6e65a7dcede4665f834
46+
modules:
47+
- flutter-sdk-3.38.2.json

‎flake.lock‎

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4+
flake-utils.url = "github:numtide/flake-utils";
5+
};
6+
7+
outputs =
8+
{
9+
self,
10+
flake-utils,
11+
nixpkgs,
12+
}:
13+
flake-utils.lib.eachDefaultSystem (
14+
system:
15+
let
16+
pkgs = import nixpkgs { inherit system; };
17+
in
18+
{
19+
devShell = pkgs.mkShell {
20+
buildInputs = with pkgs; [
21+
flatpak
22+
flatpak-builder
23+
];
24+
};
25+
}
26+
);
27+
}

‎flatpak-flutter.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
app-id: com.onclebob.Bob
2+
runtime: org.freedesktop.Platform
3+
runtime-version: "25.08"
4+
sdk: org.freedesktop.Sdk
5+
sdk-extensions:
6+
- org.freedesktop.Sdk.Extension.llvm21
7+
command: com.onclebob.Bob
8+
finish-args:
9+
- --share=ipc
10+
- --share=network
11+
- --filesystem=host
12+
- --socket=wayland
13+
- --socket=fallback-x11
14+
- --device=dri
15+
modules:
16+
- name: Bob
17+
buildsystem: simple
18+
build-options:
19+
arch:
20+
x86_64:
21+
env:
22+
BUNDLE_PATH: build/linux/x64/release/bundle
23+
aarch64:
24+
env:
25+
BUNDLE_PATH: build/linux/arm64/release/bundle
26+
append-path: /usr/lib/sdk/llvm21/bin:/un/build/OncleBob/flutter/bin
27+
prepend-ld-library-path: /usr/lib/sdk/llvm21/lib
28+
env:
29+
PUB_CACHE: /run/build/Bob/.pub-cache
30+
build-commands:
31+
- flutter build linux --release --no-pub
32+
- install -D $BUNDLE_PATH/bob /app/bin/com.onclebob.Bob
33+
- cp -r $BUNDLE_PATH/lib /app/bin/lib
34+
- cp -r $BUNDLE_PATH/data /app/bin/data
35+
- install -Dm644 linux/com.onclebob.Bob.png /app/share/icons/hicolor/512x512/apps/com.onclebob.Bob.png
36+
- install -Dm644 linux/com.onclebob.Bob.desktop /app/share/applications/com.onclebob.Bob.desktop
37+
sources:
38+
- type: git
39+
url: https://github.com/flutter/flutter.git
40+
tag: 3.38.2
41+
dest: flutter
42+
- type: git
43+
url: https://github.com/xmit-co/bob.git
44+
tag: v0.0.2-flatpak
45+
commit: 9de570d132aedbcf4f86c6e65a7dcede4665f834

0 commit comments

Comments
 (0)