Skip to content

Commit df565cf

Browse files
committed
initial
0 parents  commit df565cf

11 files changed

Lines changed: 3444 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: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
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: Install OSTree
147+
run: |
148+
sudo apt-get update
149+
sudo apt-get install -y ostree
150+
151+
- name: Merge OSTree repositories
152+
run: |
153+
ostree init --repo=dist --mode=archive-z2
154+
155+
# Find all downloaded repo directories
156+
for repo_dir in repos/ostree-repo-*/; do
157+
if [ -d "$repo_dir" ] && [ -f "$repo_dir/config" ]; then
158+
echo "Processing repository: $repo_dir"
159+
160+
# Create refs/remotes directory if it doesn't exist to prevent errors
161+
mkdir -p "$repo_dir/refs/remotes"
162+
163+
# List available refs in source repo
164+
echo "Available refs in source repo:"
165+
ostree refs --repo="$repo_dir" || echo "No refs found"
166+
167+
# Pull all refs from the source repo
168+
for ref in $(ostree refs --repo="$repo_dir" 2>/dev/null || true); do
169+
echo "Pulling ref: $ref"
170+
ostree pull-local --repo=dist "$repo_dir" "$ref" || echo "Warning: Failed to pull $ref"
171+
done
172+
fi
173+
done
174+
175+
# List what we have in the merged repo
176+
echo "Merged repository contents:"
177+
ostree refs --repo=dist || echo "No refs found in merged repo"
178+
179+
- name: Import GPG key for repo signing
180+
env:
181+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
182+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
183+
run: |
184+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
185+
echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf
186+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
187+
gpg-connect-agent reloadagent /bye
188+
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2 | head -n1)
189+
echo "GPG_KEY_ID=$GPG_KEY_ID" >> $GITHUB_ENV
190+
191+
# Get the keygrip for the signing key
192+
KEYGRIP=$(gpg --with-keygrip --list-secret-keys "$GPG_KEY_ID" | grep "Keygrip" | head -n1 | awk '{print $3}')
193+
194+
# Preset the passphrase in the gpg-agent cache
195+
echo "$GPG_PASSPHRASE" | /usr/lib/gnupg/gpg-preset-passphrase --preset "$KEYGRIP"
196+
197+
- name: Sign OSTree repository
198+
run: |
199+
ostree summary --repo=dist --update --gpg-sign=${{ env.GPG_KEY_ID }} --gpg-homedir=$HOME/.gnupg
200+
201+
- name: Install xmit
202+
run: |
203+
XMIT_VERSION=$(curl -s https://api.github.com/repos/xmit-co/xmit/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
204+
curl -sL "https://github.com/xmit-co/xmit/releases/download/${XMIT_VERSION}/xmit_${XMIT_VERSION#v}_linux_amd64.tgz" -o xmit.tgz
205+
tar -xzf xmit.tgz
206+
chmod +x xmit_${XMIT_VERSION#v}_linux_amd64/xmit
207+
sudo mv xmit_${XMIT_VERSION#v}_linux_amd64/xmit /usr/local/bin/
208+
209+
- name: Upload to xmit
210+
env:
211+
XMIT_KEY: ${{ secrets.XMIT_KEY }}
212+
run: |
213+
/usr/local/bin/xmit flatpak.onclebob.com

‎.gitignore‎

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

‎com.onclebob.Bob.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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.3
45+
modules:
46+
- flutter-sdk-3.38.3.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+
}

0 commit comments

Comments
 (0)