Skip to content

ci: Add Flatpak deployment pipeline - #71

Draft
riftrogue wants to merge 21 commits into
denislupookov:mainfrom
riftrogue:feature/flatpak-ci
Draft

ci: Add Flatpak deployment pipeline#71
riftrogue wants to merge 21 commits into
denislupookov:mainfrom
riftrogue:feature/flatpak-ci

Conversation

@riftrogue

@riftrogue riftrogue commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a CI/CD pipeline for Flatpak that publishes to an OSTree repository hosted on GitHub Pages. This handles building the bundle, cryptographically signing the commits, and maintaining a delta-update repository so users don't have to download the full bundle for every update.

Changes

  • Created .github/workflows/flatpak-publish.yml to automate Flatpak builds via flatpak-builder inside an isolated, privileged container.
  • Configured GitHub Pages deployment (peaceiris/actions-gh-pages) to host the OSTree repository.
  • Security & Integrity: Implemented full GPG signing. Individual OSTree commits are signed at build time, and the repository summary is signed during the update-repo step.
  • UX Improvement: Automatically generates an altersend.flatpakrepo file with the embedded public GPG key on every run. Users can download and click this file to add the official remote in one click, without terminal commands.
  • Reliability: Added ostree fsck auto-healing logic. If the repository ever becomes corrupted, the pipeline will detect it, wipe the corrupt directory, and automatically reinitialize it from scratch.
  • Added strict path filtering, concurrency limits, and offline caching (using node-modules.json) to drastically optimize workflow run time and resources.

Setup Required (For Denis)

Before this workflow can run successfully on your account, you need to set up the hosting repository and the required security secrets:

1. Create the Deployment Repository

  • Create a new empty public repository on your account named altersend-flatpak.

2. Setup GitHub Pages Token

  • Generate a Classic Personal Access Token (PAT) with repo permissions.
  • In this altersend repository, go to Settings > Secrets and variables > Actions.
  • Add a new repository secret named FLATPAK_PUBLISH_TOKEN and paste your PAT.

3. Setup GPG Signing Keys

  • Generate a GPG key for signing the flatpak packages (e.g., gpg --quick-gen-key "AlterSend Flatpak <flatpak@altersend.com>").
  • Export the private key as an ASCII armored block: gpg --armor --export-secret-keys <fingerprint>.
  • In the altersend repository Actions Secrets, add a secret named FLATPAK_GPG_PRIVATE_KEY containing the entire exported private key block.
  • (Optional) If your GPG key has a passphrase, you must add it as a secret named FLATPAK_GPG_PASSPHRASE, and uncomment lines 66-67 in .github/workflows/flatpak-publish.yml.

Known Limitations & Future Improvements

  • SDK Version Mismatch: The Flatpak manifest targets the 25.08 SDK, but the official Docker image used for the build environment is currently stuck on 24.08. This causes the pipeline to dynamically download the 25.08 SDK at build time (adding ~3-4 minutes). Once a 25.08 Docker image is released, we can bump the container version to instantly fix this.
  • x86_64 Only: This initial pipeline only targets x86_64 to save GitHub Actions minutes. We can easily add ARM64 support in the future by adding a matrix job with ubuntu-24.04-arm (similar to the AppImage workflow).

Testing

  • Manually verified on desktop
    (Tested pipeline execution on personal fork, confirming successful OSTree creation, 1.3GB cache restorations, delta updates, GPG signature verification, and successful local installation via the deployed .flatpakrepo file).

Screenshots / recordings

(Not applicable - CI pipeline changes only)

Related issues

(None)

@riftrogue
riftrogue requested a review from denislupookov as a code owner July 28, 2026 20:27
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that builds and publishes the Flatpak repository, plus README instructions for configuring that repository and installing AlterSend from it.

Changes

Flatpak publishing

Layer / File(s) Summary
Build and publish workflow
.github/workflows/flatpak-publish.yml
Adds push and manual triggers, containerized Flatpak builds, OSTree repository reuse, bundle configuration, concurrency control, and deployment to the external repository.
Repository installation instructions
README.md
Documents the unverified repository, direct installation commands, and local manifest installation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: denislupookov

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant OSTreeRepository
  participant FlatpakBuilder
  participant ActionsGhPages
  GitHubActions->>OSTreeRepository: Check out and validate repository
  GitHubActions->>FlatpakBuilder: Build Flatpak bundle and repository
  GitHubActions->>ActionsGhPages: Publish updated OSTree repository
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding a Flatpak deployment pipeline.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/flatpak-publish.yml (3)

28-31: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin all secret-bearing actions to immutable SHAs.

The Flatpak builder is pinned, but actions/checkout@v4 and peaceiris/actions-gh-pages@v4 remain mutable tag references while handling credentials and publishing access. Pin these actions to verified full-length commit SHAs. GitHub recommends SHA pinning to ensure the reviewed action code cannot change underneath the workflow. (docs.github.com)

Also applies to: 58-60

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/flatpak-publish.yml around lines 28 - 31, Update the
secret-bearing action references in the Flatpak publish workflow, including both
actions/checkout steps and peaceiris/actions-gh-pages, to verified immutable
full-length commit SHAs while preserving their existing actions and inputs.

27-37: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Disable credential persistence for both checkouts.

actions/checkout persists its token in local Git configuration by default. The first checkout leaves credentials available during later build steps, while the second checkout relies on deleting repo/.git afterward. Set persist-credentials: false on both steps instead. (github.com)

       - name: Checkout repository
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false

       - name: Checkout existing OSTree repo for delta updates
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false
           repository: denislupookov/altersend-flatpak
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/flatpak-publish.yml around lines 27 - 37, Update both
checkout steps in the workflow, including the primary repository checkout and
the existing OSTree repository checkout, to set actions/checkout’s
persist-credentials option to false. Keep the existing repository, ref, path,
token, and continue-on-error settings unchanged.

Source: Linters/SAST tools


30-45: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Do not treat every checkout failure as an empty OSTree repository.

continue-on-error: true hides authentication, network, wrong-branch, and partial-checkout failures. The subsequent repo/config existence check is not sufficient to distinguish a valid OSTree repository from arbitrary or incomplete content. Preflight the external repository explicitly and only initialize a new repository when it is confirmed empty; fail the job for other checkout errors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/flatpak-publish.yml around lines 30 - 45, Update the
“Checkout existing OSTree repo for delta updates” and “Clean and verify OSTree
repo” steps to explicitly preflight the external repository and distinguish a
confirmed empty repository from authentication, network, wrong-branch,
partial-checkout, or invalid-content failures. Remove the blanket
continue-on-error behavior, validate the checkout result and OSTree structure
before deleting .git, initialize a fresh repo only when emptiness is confirmed,
and fail the workflow for all other errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/flatpak-publish.yml:
- Around line 3-10: Add a job-level condition to the Flatpak publishing workflow
so it runs for push events on main but skips workflow_dispatch runs unless
github.ref equals refs/heads/main. Apply the guard to the publishing job rather
than changing the existing triggers.

---

Nitpick comments:
In @.github/workflows/flatpak-publish.yml:
- Around line 28-31: Update the secret-bearing action references in the Flatpak
publish workflow, including both actions/checkout steps and
peaceiris/actions-gh-pages, to verified immutable full-length commit SHAs while
preserving their existing actions and inputs.
- Around line 27-37: Update both checkout steps in the workflow, including the
primary repository checkout and the existing OSTree repository checkout, to set
actions/checkout’s persist-credentials option to false. Keep the existing
repository, ref, path, token, and continue-on-error settings unchanged.
- Around line 30-45: Update the “Checkout existing OSTree repo for delta
updates” and “Clean and verify OSTree repo” steps to explicitly preflight the
external repository and distinguish a confirmed empty repository from
authentication, network, wrong-branch, partial-checkout, or invalid-content
failures. Remove the blanket continue-on-error behavior, validate the checkout
result and OSTree structure before deleting .git, initialize a fresh repo only
when emptiness is confirmed, and fail the workflow for all other errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b75d50a5-6b48-4937-8434-a9aa9996352a

📥 Commits

Reviewing files that changed from the base of the PR and between a9c77dc and a6ff2b8.

📒 Files selected for processing (1)
  • .github/workflows/flatpak-publish.yml

Comment thread .github/workflows/flatpak-publish.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 90-91: Update the Flatpak installation instructions to avoid
presenting the unsigned repository as an official installation path: either add
OSTree repository signing and publish the verification key before removing
--no-gpg-verify, or clearly label the current commands as an explicitly unsafe
preview.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 17caf55c-2c5d-4b9b-b3c0-495ede0642fd

📥 Commits

Reviewing files that changed from the base of the PR and between a6ff2b8 and 9db0804.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/flatpak-publish.yml (2)

31-46: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Fail closed when the external OSTree checkout fails.

continue-on-error: true makes network/authentication failures indistinguishable from an intentionally empty repository. The following cleanup can then initialize and publish a new repository over the existing one, losing delta history and potentially disrupting clients. Only initialize a genuinely empty repository; otherwise run ostree fsck and abort on checkout or validation failures.

Proposed direction
       - name: Checkout existing OSTree repo for delta updates
         uses: actions/checkout@v4
-        continue-on-error: true
         with:
           repository: denislupookov/altersend-flatpak
           ref: main
           path: repo
           token: ${{ secrets.FLATPAK_PUBLISH_TOKEN }}

       - name: Clean and verify OSTree repo
         run: |
-          rm -rf repo/.git
-          if [ ! -f "repo/config" ]; then
-            echo "Not a valid OSTree repository (likely a fresh GitHub repo). Cleaning up so flatpak-builder can initialize it."
+          if [ -f repo/config ]; then
+            ostree fsck --repo=repo
+            rm -rf repo/.git
+          elif [ -z "$(find repo -mindepth 1 -maxdepth 1 ! -name .git -print -quit)" ]; then
             rm -rf repo
+          else
+            echo "External repository is neither empty nor a valid OSTree repository." >&2
+            exit 1
           fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/flatpak-publish.yml around lines 31 - 46, Update the
“Checkout existing OSTree repo for delta updates” and “Clean and verify OSTree
repo” steps to fail closed: remove continue-on-error, distinguish a genuinely
empty repository from checkout failures, and never delete or reinitialize repo
after an unsuccessful checkout. For an existing checkout, remove Git metadata,
validate repo/config, run ostree fsck, and abort the workflow on any validation
failure; only allow flatpak-builder initialization when the repository is
intentionally empty.

21-22: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pin privileged publishing job dependencies to immutable references.

This publishing container runs with --privileged and later accepts a writing token (secrets.FLATPAK_PUBLISH_TOKEN) inside the same job. Pin the container image by digest, actions/checkout@v4 to full commit SHAs across lines 29 and 32, and peaceiris/actions-gh-pages@v4 to a full commit SHA. The Flatpak builder action is already pinned.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/flatpak-publish.yml around lines 21 - 22, Pin the
privileged publishing job’s mutable dependencies to immutable references:
replace the Flatpak container tag with its full image digest, pin both
actions/checkout@v4 usages around lines 29 and 32 to full commit SHAs, and pin
peaceiris/actions-gh-pages@v4 to its full commit SHA. Leave the already-pinned
Flatpak builder action unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/flatpak-publish.yml:
- Around line 31-46: Update the “Checkout existing OSTree repo for delta
updates” and “Clean and verify OSTree repo” steps to fail closed: remove
continue-on-error, distinguish a genuinely empty repository from checkout
failures, and never delete or reinitialize repo after an unsuccessful checkout.
For an existing checkout, remove Git metadata, validate repo/config, run ostree
fsck, and abort the workflow on any validation failure; only allow
flatpak-builder initialization when the repository is intentionally empty.
- Around line 21-22: Pin the privileged publishing job’s mutable dependencies to
immutable references: replace the Flatpak container tag with its full image
digest, pin both actions/checkout@v4 usages around lines 29 and 32 to full
commit SHAs, and pin peaceiris/actions-gh-pages@v4 to its full commit SHA. Leave
the already-pinned Flatpak builder action unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cc3fad6d-24c2-45f3-9f75-9ff75e47fc4c

📥 Commits

Reviewing files that changed from the base of the PR and between 9db0804 and 45cf364.

📒 Files selected for processing (1)
  • .github/workflows/flatpak-publish.yml

@riftrogue

Copy link
Copy Markdown
Contributor Author

@coderabbitai
Thanks for the catches! Both of these issues have been addressed:

OSTree Delta History: Removed continue-on-error and added the ostree fsck validation to ensure the delta history is never accidentally overwritten due to a network failure during checkout (fixed in 6311515).

Dependency Pinning: Updated the privileged container to use its exact sha256 digest, and pinned all GitHub Actions to their full immutable commit SHAs (fixed in 0a34fe0).

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@riftrogue Thanks for addressing both findings. The OSTree validation and immutable dependency pinning changes resolve the concerns I raised.

🐇✨


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

@riftrogue
riftrogue force-pushed the feature/flatpak-ci branch from 0a34fe0 to d5834e2 Compare July 28, 2026 21:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/flatpak-publish.yml (1)

28-37: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Disable credential persistence for both checkouts.

Both actions/checkout steps keep the token in the workspace Git config by default. Add persist-credentials: false to each checkout: the initial fetch can still authenticate, but later build/deploy steps cannot reuse those persisted credentials.

Proposed fix
       - name: Checkout repository
         uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+        with:
+          persist-credentials: false

       - name: Checkout existing OSTree repo for delta updates
         uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
         with:
+          persist-credentials: false
           repository: denislupookov/altersend-flatpak
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/flatpak-publish.yml around lines 28 - 37, Update both
checkout steps in the workflow, including the repository checkout and the
existing OSTree repository checkout, to set persist-credentials to false while
preserving their current authentication inputs and checkout configuration.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/flatpak-publish.yml:
- Around line 28-37: Update both checkout steps in the workflow, including the
repository checkout and the existing OSTree repository checkout, to set
persist-credentials to false while preserving their current authentication
inputs and checkout configuration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 483c58f2-a114-4d5f-b674-a07a61f2a4eb

📥 Commits

Reviewing files that changed from the base of the PR and between 6311515 and d5834e2.

📒 Files selected for processing (2)
  • .github/workflows/flatpak-publish.yml
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

@riftrogue

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/flatpak-publish.yml:
- Around line 28-29: Update both actions/checkout steps in the workflow to set
persist-credentials to false, ensuring checkout credentials are not retained for
subsequent build or workflow commands.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5d8738fd-bb79-407a-9d27-f05b07e7812c

📥 Commits

Reviewing files that changed from the base of the PR and between 6311515 and d5834e2.

📒 Files selected for processing (2)
  • .github/workflows/flatpak-publish.yml
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

Comment thread .github/workflows/flatpak-publish.yml
@riftrogue
riftrogue marked this pull request as draft July 28, 2026 21:56
@riftrogue

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant