Skip to content

Commit

Permalink
try to set up fdroid repo 6
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaiiDango committed Mar 10, 2024
1 parent ce780aa commit 86da6e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/fdroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
- name: Run update script
run: cd fdroid-repo/fdroid && bash update.sh 2>&1

- name: Remove repo secrets
run: rm -r fdroid-repo/fdroid/keystore.p12 fdroid-repo/fdroid/config.yml fdroid-repo/fdroid/tmp fdroid-repo/fdroid/srclibs fdroid-repo/fdroid/update.sh
- name: Remove unneded files and secrets
run: rm -r fdroid-repo/fdroid/keystore.p12 fdroid-repo/fdroid/config.yml fdroid-repo/fdroid/tmp fdroid-repo/fdroid/srclibs fdroid-repo/fdroid/update.sh fdroid-repo/fdroid/metadata

- name: Fix permissions
run: |
Expand Down
37 changes: 15 additions & 22 deletions fdroid-repo/fdroid/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,39 @@ PACKAGE=com.arn.scrobble
# Define the URL of the GitHub repository
REPO_URL="https://api.github.com/repos/$USER/$REPO/releases"

# Check if jq package is installed, and install it if necessary
if ! command -v jq &> /dev/null; then
sudo apt-get install -y jq
fi

# Use curl to get the JSON response for all releases
JSON=$(curl --silent "$REPO_URL")

# Extract the URLs of the assets named "pano-scrobbler-release.apk" and the corresponding tags
# Extract the URLs of the assets named "pano-scrobbler-release.apk", the corresponding tags, the created_at dates
ASSET_URLS=$(echo "$JSON" | jq -r '.[] | select(.assets[0].name | endswith(".apk")) | .assets[0].browser_download_url')
TAGS=$(echo "$JSON" | jq -r '.[] | select(.assets[0].name | endswith(".apk")) | .tag_name')
DATES=$(echo "$JSON" | jq -r '.[] | select(.assets[0].name | endswith(".apk")) | .created_at')

# Convert the URLs and tags to arrays
# Convert the URLs, tags, dates to arrays
ASSET_URLS=($ASSET_URLS)
TAGS=($TAGS)
DATES=($DATES)

# Download the last 5 assets
# Download the last 5 assets and create the changelogs
mkdir -p "metadata/${PACKAGE}/en-US/changelogs"
for ((i=0; i<${#ASSET_URLS[@]} && i<5; i++)); do
curl -L --create-dirs -o "repo/${REPO}-${TAGS[$i]}.apk" "${ASSET_URLS[$i]}"
done

# create changelogs from github release body
mkdir -p "repo/${PACKAGE}/en-US/changelogs"
for ((i=0; i<${#ASSET_URLS[@]} && i<5; i++)); do
echo "Creating changelog for ${TAGS[$i]}"
echo -e "## ${TAGS[$i]}\n" > "repo/${PACKAGE}/en-US/changelogs/${TAGS[$i]}.txt"
curl -L "https://api.github.com/repos/$USER/$REPO/releases/tags/${TAGS[$i]}" | jq -r '.body' >> "repo/${PACKAGE}/en-US/changelogs/${TAGS[$i]}.txt"
touch -d "${DATES[$i]}" "repo/${REPO}-${TAGS[$i]}.apk"
CHANGELOG=$(echo "$JSON" | jq -r ".[$i] | .body")
echo -e "## ${TAGS[$i]}\n${CHANGELOG}" > "metadata/${PACKAGE}/en-US/changelogs/${TAGS[$i]}.txt"
done

# download screenshots
curl -L --create-dirs -o "repo/${PACKAGE}/en-US/phoneScreenshots/1scrobbles.png" "https://i.imgur.com/pgETfhc.png"
curl -L -o "repo/${PACKAGE}/en-US/phoneScreenshots/2friends.png" "https://i.imgur.com/Q7yPi2z.png"
curl -L -o "repo/${PACKAGE}/en-US/phoneScreenshots/3charts.png" "https://i.imgur.com/MUhcyBw.png"
curl -L -o "repo/${PACKAGE}/en-US/phoneScreenshots/4random.png" "https://i.imgur.com/aikbtGR.png"
curl -L --create-dirs -o "metadata/${PACKAGE}/en-US/phoneScreenshots/1scrobbles.png" "https://i.imgur.com/pgETfhc.png"
curl -L -o "metadata/${PACKAGE}/en-US/phoneScreenshots/2friends.png" "https://i.imgur.com/Q7yPi2z.png"
curl -L -o "metadata/${PACKAGE}/en-US/phoneScreenshots/3charts.png" "https://i.imgur.com/MUhcyBw.png"
curl -L -o "metadata/${PACKAGE}/en-US/phoneScreenshots/4random.png" "https://i.imgur.com/aikbtGR.png"

# copy icon
cp ../../app/src/main/play/listings/en-US/icon/icon.png "repo/${PACKAGE}/en-US/icon.png"
cp ../../app/src/main/play/listings/en-US/icon/icon.png "metadata/${PACKAGE}/en-US/icon.png"

# Run fdroid update
fdroid update --create-metadata
fdroid update --create-metadata --use-date-from-apk

# Replace the default icon
cp ../../app/src/main/play/listings/en-US/icon/icon.png repo/icons/icon.png

0 comments on commit 86da6e6

Please sign in to comment.