diff --git a/.github/workflows/fdroid.yml b/.github/workflows/fdroid.yml index 408d21f..6e183de 100644 --- a/.github/workflows/fdroid.yml +++ b/.github/workflows/fdroid.yml @@ -22,11 +22,10 @@ jobs: - name: Create directory structure run: mkdir -p fdroid/repo - - name: Restore mtime + - name: Install tools run: | - sudo apt install git-restore-mtime - git restore-mtime - + sudo apt install xmlstarlet + - name: Install F-Droid server run: | sudo add-apt-repository ppa:fdroid/fdroidserver @@ -56,6 +55,9 @@ jobs: - name: Run update run: fdroid update --create-metadata --pretty --rename-apks working-directory: ./fdroid + + - name: Patch publishing dates + run: ./patch_publishing_dates.sh - name: Setup Pages uses: actions/configure-pages@v4 diff --git a/patch_publishing_dates.sh b/patch_publishing_dates.sh new file mode 100755 index 0000000..2280460 --- /dev/null +++ b/patch_publishing_dates.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +if ! command -v xmlstarlet $> /dev/null +then + echo "xmlstarlet could not be found, please install xmlstarlet" + exit 1 +fi + +# Patch app dates in index.xml to actual publishing dates +# $1 packageName: app package name +patch_publishing_dates () { + local packageName="$1" + + local indexFile="fdroid/repo/index.xml" + local tmpIndexFile="tmp/index.xml" + + local jsonFile="tmp/${packageName}.json" + local tags=$(jq -r '.[].tagName' "$jsonFile") + + for tagName in $tags; do + local publishedAt=$(jq -r --arg TAGNAME "$tagName" '.[] | select(.tagName==$TAGNAME) | .publishedAt[0:10]' "$jsonFile") + xmlstarlet ed \ + -u "/fdroid/application[@id='$packageName']/package/version[.='$tagName']/../added" \ + --value "$publishedAt" \ + "$indexFile" \ + > "$tmpIndexFile" + mv $tmpIndexFile $indexFile + done +} + +patch_publishing_dates com.fsck.k9