Skip to content

Commit

Permalink
Add deploy-flatpak script
Browse files Browse the repository at this point in the history
  • Loading branch information
ranfdev committed Jun 9, 2022
1 parent fb34a9b commit dde4d90
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build-aux/build-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e
# Read data from manifest
folder=$1
manifest=$2;


name=$(< "$manifest" jq -r '.["modules"] | last | .["name"]');
appid=$(< "$manifest" jq -r '.["app-id"]');
runtime=$(< "$manifest" jq -r '"runtime/" + .["runtime"] + "/x86_64/" + .["runtime-version"]');
Expand Down Expand Up @@ -32,7 +34,7 @@ mkdir "$folder";
# Generate dist archive and the release manifest
flatpak-builder --user "$folder"/build "$manifest" --build-only --stop-at="$name" --keep-build-dirs --force-clean;
echo "meson dist --include-subprojects --no-tests" | flatpak-builder --user "$folder"/build "$manifest" --build-shell="$name" --keep-build-dirs --state-dir="$folder"/state;
< "$manifest" jq '(.["modules"] | last | .["sources"] | last) |= {type: "archive", path: "archive.tar.xz"}' > "$folder"/manifest-archive.json;
< "$manifest" jq '(.["modules"] | last | .["sources"] | last) |= {type: "archive", path: "generated-archive.tar.xz"}' > "$folder"/manifest-archive.json;

# Build the app from the dist archive, using the corrected manifest
cd "$folder"/;
Expand Down
22 changes: 22 additions & 0 deletions build-aux/deploy-flatpak.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# This scripts edits the flatpak manifest to fetch the source archive from a url
# and sets the correct hash for that archive.
set -e

manifest=$1;
archive=$2;
url=$3;
git_out=$4;

sha256=$(sha256sum $archive | awk '{print $1}');
echo $sha256;
mv "$manifest" "$manifest.old"
< "$manifest.old" jq --arg url $url --arg sha "$sha256" '(.["modules"] | last | .["sources"] | last) |= {type: "archive", url: $url, sha256: $sha}' > "$manifest";

# Clone the flathub repo, commit update, push
git clone "$git_out" git_repo;
cd $_;
cp ../"$manifest" ./;
git commit -a -m "Update";
git push

0 comments on commit dde4d90

Please sign in to comment.