Skip to content

Commit

Permalink
Add script to change publishing dates to their original date
Browse files Browse the repository at this point in the history
  • Loading branch information
wmontwe committed Feb 8, 2024
1 parent 0ced0f1 commit 212e0b9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/fdroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions patch_publishing_dates.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 212e0b9

Please sign in to comment.