Tell people how to use the F-Droid repository

316291c · Gabriel Morell · 2026-09-12 18:12

11 files +84 -4
Message
{commit_body(@commit)}

Files changed

modified lib/git_gud/packages/usage.ex
+74 −0
@@ -395,6 +395,76 @@ defmodule GitGud.Packages.Usage do
395 395 }
396 396 end
397 397
398 + # ── F-Droid ─────────────────────────────────────────────────────────
399 +
400 + def for_format("fdroid", ctx) do
401 + url = base_url(ctx, "fdroid")
402 + namespace = namespace_url(ctx, "fdroid")
403 +
404 + %{
405 + consume: [
406 + step(
407 + "Add #{ctx.handle} as a repository in F-Droid",
408 + "shell",
409 + """
410 + #{namespace}?fingerprint=<fingerprint>
411 + """
412 + ),
413 + step(
414 + "Get the fingerprint",
415 + "shell",
416 + """
417 + curl -fsSL #{key_url(ctx, "fdroid")}
418 + """
419 + ),
420 + step(
421 + "…or add just this repository",
422 + "shell",
423 + """
424 + #{url}?fingerprint=<fingerprint>
425 + """
426 + ),
427 + step(
428 + "A private repository needs a token",
429 + "shell",
430 + """
431 + # F-Droid: Settings -> Repositories -> this repo -> Username / Password
432 + username: __token__
433 + password: <ggrt_…>
434 + """
435 + )
436 + ],
437 + publish: [
438 + step(
439 + "Upload an APK",
440 + "shell",
441 + """
442 + curl -fsSL --fail \\
443 + -H "Authorization: $GITGUD_TOKEN" \\
444 + -H "Content-Type: application/vnd.android.package-archive" \\
445 + --data-binary @app-release.apk \\
446 + "#{url}/upload"
447 + """
448 + )
449 + ],
450 + ci: [
451 + step(
452 + "Publish from a workflow",
453 + "yaml",
454 + """
455 + - name: Publish to the F-Droid repository
456 + run: |
457 + curl -fsSL --fail \\
458 + -H "Authorization: ${{ github.token }}" \\
459 + -H "Content-Type: application/vnd.android.package-archive" \\
460 + --data-binary @app-release.apk \\
461 + "#{url}/upload"
462 + """
463 + )
464 + ]
465 + }
466 + end
467 +
398 468 # ── OCI ─────────────────────────────────────────────────────────────
399 469
400 470 # Container images are zot's, not ours; these instructions describe
@@ -448,6 +518,10 @@ defmodule GitGud.Packages.Usage do
448 518 def summary("hex"), do: "Hex registry v2, signed. Works with mix out of the box."
449 519 def summary("cargo"), do: "Sparse HTTP index — cargo publish, add, yank."
450 520 def summary("deb"), do: "A signed Debian repository — apt-get update and install."
521 +
522 + def summary("fdroid"),
523 + do: "An F-Droid app repository — add it once, install and update from the phone."
524 +
451 525 def summary("oci"), do: "Container images, served by the bundled OCI registry."
452 526 def summary(_), do: nil
453 527
modified lib/git_gud_web/live/repo_live/packages.ex
+3 −2
@@ -33,14 +33,15 @@ defmodule GitGudWeb.RepoLive.Packages do
33 33
34 34 # Display order: containers first (the oldest surface here), then the
35 35 # language registries in the order they landed.
36 − @format_order ~w(oci pypi hex cargo deb)
36 + @format_order ~w(oci pypi hex cargo deb fdroid)
37 37
38 38 @format_labels %{
39 39 "oci" => "Container images",
40 40 "pypi" => "Python",
41 41 "hex" => "Hex",
42 42 "cargo" => "Crates",
43 − "deb" => "Debian packages"
43 + "deb" => "Debian packages",
44 + "fdroid" => "Android apps"
44 45 }
45 46
46 47 @facets [
modified test/git_gud_web/package_usage_test.exs
+7 −2
@@ -98,8 +98,13 @@ defmodule GitGudWeb.PackageUsageTest do
98 98 end
99 99
100 100 describe "Usage.for_format/2" do
101 + # Derived from Format.formats/0 rather than listed here. A
102 + # hardcoded list is how `fdroid` shipped with a registry, an
103 + # adapter and a signed index, and a packages page that said "No
104 + # instructions for this format" — nothing failed, because nothing
105 + # was looking.
101 106 test "every format the forge serves has both facets", %{ctx: ctx} do
102 − for format <- ~w(pypi hex cargo deb oci) do
107 + for format <- GitGud.Packages.Format.formats() do
103 108 usage = Usage.for_format(format, ctx)
104 109
105 110 assert usage, "#{format} has no instructions"
@@ -117,7 +122,7 @@ defmodule GitGudWeb.PackageUsageTest do
117 122 end
118 123
119 124 test "every CI snippet uses the per-job token, never a stored secret", %{ctx: ctx} do
120 − for format <- ~w(pypi hex cargo deb oci) do
125 + for format <- GitGud.Packages.Format.formats() do
121 126 code = Enum.map_join(Usage.for_format(format, ctx).ci, "\n", & &1.code)
122 127
123 128 assert code =~ "github.token", "#{format}'s CI snippet doesn't use github.token"

Parents: 5b6cd9c