66 branches : [ main ]
77 paths-ignore :
88 - ' README.md'
9- - ' app-repo.json'
109 - ' gallery/**'
1110 - ' website/**'
1211 - ' .github/**'
@@ -389,20 +388,15 @@ jobs:
389388 --repo "$GITHUB_REPOSITORY"
390389 shell : bash
391390
392- create-app-source -json :
393- name : Update App Source JSON
391+ update-prostore-repo -json :
392+ name : Update ProStore Repo JSON
394393 needs : build-unsigned-ipa
395394 if : needs.build-unsigned-ipa.outputs.release_exists == 'false'
396395 runs-on : ubuntu-latest
397- permissions :
398- contents : write
396+ env :
397+ VERSION : ${{ needs.build-unsigned-ipa.outputs.version }}
398+ CHANGELOG : ${{ needs.build-unsigned-ipa.outputs.changelog }}
399399 steps :
400- - name : Checkout Repo
401- uses : actions/checkout@v4
402- with :
403- fetch-depth : 0
404- persist-credentials : true
405-
406400 - name : Install jq
407401 run : |
408402 # jq
@@ -420,16 +414,13 @@ jobs:
420414 name : com.prostoreios.prosign-unsigned-ios.ipa
421415 path : build
422416
423- - name : Update App Repo
417+ - name : Update Apps JSON in Pages Repo
424418 env :
425- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
426- VERSION : ${{ needs.build-unsigned-ipa.outputs.version }}
427- CHANGELOG : ${{ needs.build-unsigned-ipa.outputs.changelog }}
419+ PAGES_PAT : ${{ secrets.PAGES_PAT }}
428420 run : |
429421 set -e
430422 IPA_PATH="$PWD/build/com.prostoreios.prosign-unsigned-ios.ipa"
431423 DOWNLOAD_URL="https://github.com/ProStore-iOS/ProSign/releases/download/v$VERSION/com.prostoreios.prosign-unsigned-ios.ipa"
432- REPO_FILE="app-repo.json"
433424
434425 if [ -f "$IPA_PATH" ]; then
435426 IPA_SIZE=$(stat -c%s "$IPA_PATH")
@@ -449,7 +440,16 @@ jobs:
449440 DEVNAME="ProStore iOS"
450441 SCREENSHOTS='["https://raw.githubusercontent.com/ProStore-iOS/ProSign/refs/heads/main/gallery/Screenshot1.png","https://raw.githubusercontent.com/ProStore-iOS/ProSign/refs/heads/main/gallery/Screenshot2.png","https://raw.githubusercontent.com/ProStore-iOS/ProSign/refs/heads/main/gallery/Screenshot3.png","https://raw.githubusercontent.com/ProStore-iOS/ProSign/refs/heads/main/gallery/Screenshot4.png","https://raw.githubusercontent.com/ProStore-iOS/ProSign/refs/heads/main/gallery/Screenshot5.png"]'
451442
452- # Create base repo JSON safely (single command, YAML-friendly)
443+ PAGES_REPO="ProStore-iOS/ProStore-iOS.github.io"
444+ PAGES_DIR=$(mktemp -d)
445+
446+ echo "Cloning pages repo (masked token)..."
447+ git clone --depth 1 "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" "$PAGES_DIR"
448+
449+ cd "$PAGES_DIR"
450+ REPO_FILE="apps.json"
451+
452+ # Create base repo JSON if missing (first run only)
453453 if [ ! -f "$REPO_FILE" ]; then
454454 jq -n --arg icon "$ICON_URL" '{
455455 name: "Official ProStore Repo",
@@ -476,8 +476,8 @@ jobs:
476476 --argjson size "$IPA_SIZE" \
477477 '{version: $version, date: $date, localizedDescription: $desc, downloadURL: $url, size: $size, sha256: $sha, minOSVersion: $minos, fullDate: $fulldate}')
478478
479- # Single-line jq filter (YAML-friendly)
480- JQ_QUERY='if ( .apps | map(.bundleIdentifier // .bundleID) | index($bundle) ) then .apps |= map( if ((.bundleIdentifier // .bundleID) == $bundle) then ( { "name": $name, "bundleIdentifier": $bundle, "developerName": $dev, "localizedDescription": $appdesc, "iconURL": $icon, "screenshotURLs": $screenshots } + { "versions": ( [ $newVer ] + ( .versions // [] ) ) } ) else . end ) else .apps += [ { "name": $name, "bundleIdentifier": $bundle, "developerName": $dev, "localizedDescription": $appdesc, "iconURL": $icon, "screenshotURLs": $screenshots, "versions": [ $newVer ] } ] end'
479+ # Single-line jq filter (YAML-friendly, with .apps //= [] for robustness )
480+ JQ_QUERY='(.apps //= []) | if ( .apps | map(.bundleIdentifier // .bundleID) | index($bundle) ) then .apps |= map( if ((.bundleIdentifier // .bundleID) == $bundle) then ( { "name": $name, "bundleIdentifier": $bundle, "developerName": $dev, "localizedDescription": $appdesc, "iconURL": $icon, "screenshotURLs": $screenshots } + { "versions": ( [ $newVer ] + ( .versions // [] ) ) } ) else . end ) else .apps += [ { "name": $name, "bundleIdentifier": $bundle, "developerName": $dev, "localizedDescription": $appdesc, "iconURL": $icon, "screenshotURLs": $screenshots, "versions": [ $newVer ] } ] end'
481481
482482 # Update or create the app entry (pass screenshots as argjson directly)
483483 jq --argjson newVer "$NEW_VERSION" \
@@ -489,47 +489,11 @@ jobs:
489489 --argjson screenshots "$SCREENSHOTS" \
490490 "$JQ_QUERY" "$REPO_FILE" > "$TMP" && mv "$TMP" "$REPO_FILE"
491491
492- # Safe commit & push
493- git config user.name "github-actions"
494- git config user.email "github-actions@github.com"
495- git add "$REPO_FILE"
496- git commit -m "Update ProStore app repo to v$VERSION" || echo "No changes to commit"
497-
498- git fetch origin main --quiet
499- if git rev-parse --verify origin/main >/dev/null 2>&1; then
500- if git rebase origin/main; then
501- echo "Rebase succeeded, pushing changes..."
502- git push origin HEAD:main
503- else
504- echo "Rebase failed — aborting rebase and skipping push."
505- git rebase --abort || true
506- fi
507- else
508- git push origin HEAD:main
509- fi
510- shell : bash
511-
512- - name : Push to GitHub Pages
513- env :
514- PAGES_PAT : ${{ secrets.PAGES_PAT }}
515- run : |
516- set -e
517- VERSION="${{ needs.build-unsigned-ipa.outputs.version }}"
518- PAGES_REPO="ProStore-iOS/ProStore-iOS.github.io"
519- PAGES_DIR=$(mktemp -d)
520-
521- echo "Cloning pages repo (masked token)..."
522- git clone --depth 1 "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" "$PAGES_DIR"
523-
524- echo "Copying app-repo.json -> apps.json in pages repo"
525- cp app-repo.json "$PAGES_DIR/apps.json"
526-
527- cd "$PAGES_DIR"
528492 git config user.name "github-actions[bot]"
529493 git config user.email "github-actions[bot]@users.noreply.github.com"
530494
531495 # Only commit if there's a change
532- git add apps.json
496+ git add "$REPO_FILE"
533497 if git diff --quiet --cached; then
534498 echo "No changes to apps.json — nothing to commit/push."
535499 exit 0
0 commit comments