Skip to content

Commit dde4d90

Browse files
committed
Add deploy-flatpak script
1 parent fb34a9b commit dde4d90

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

build-aux/build-flatpak.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -e
44
# Read data from manifest
55
folder=$1
66
manifest=$2;
7+
8+
79
name=$(< "$manifest" jq -r '.["modules"] | last | .["name"]');
810
appid=$(< "$manifest" jq -r '.["app-id"]');
911
runtime=$(< "$manifest" jq -r '"runtime/" + .["runtime"] + "/x86_64/" + .["runtime-version"]');
@@ -32,7 +34,7 @@ mkdir "$folder";
3234
# Generate dist archive and the release manifest
3335
flatpak-builder --user "$folder"/build "$manifest" --build-only --stop-at="$name" --keep-build-dirs --force-clean;
3436
echo "meson dist --include-subprojects --no-tests" | flatpak-builder --user "$folder"/build "$manifest" --build-shell="$name" --keep-build-dirs --state-dir="$folder"/state;
35-
< "$manifest" jq '(.["modules"] | last | .["sources"] | last) |= {type: "archive", path: "archive.tar.xz"}' > "$folder"/manifest-archive.json;
37+
< "$manifest" jq '(.["modules"] | last | .["sources"] | last) |= {type: "archive", path: "generated-archive.tar.xz"}' > "$folder"/manifest-archive.json;
3638

3739
# Build the app from the dist archive, using the corrected manifest
3840
cd "$folder"/;

build-aux/deploy-flatpak.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# This scripts edits the flatpak manifest to fetch the source archive from a url
4+
# and sets the correct hash for that archive.
5+
set -e
6+
7+
manifest=$1;
8+
archive=$2;
9+
url=$3;
10+
git_out=$4;
11+
12+
sha256=$(sha256sum $archive | awk '{print $1}');
13+
echo $sha256;
14+
mv "$manifest" "$manifest.old"
15+
< "$manifest.old" jq --arg url $url --arg sha "$sha256" '(.["modules"] | last | .["sources"] | last) |= {type: "archive", url: $url, sha256: $sha}' > "$manifest";
16+
17+
# Clone the flathub repo, commit update, push
18+
git clone "$git_out" git_repo;
19+
cd $_;
20+
cp ../"$manifest" ./;
21+
git commit -a -m "Update";
22+
git push

0 commit comments

Comments
 (0)