@@ -16,6 +16,7 @@ permissions:
1616
1717jobs :
1818 build-unsigned-ipa :
19+ name : Build IPA
1920 runs-on : macos-15
2021 timeout-minutes : 60
2122 outputs :
@@ -347,6 +348,7 @@ jobs:
347348 shell : bash
348349
349350 create-github-release :
351+ name : Create GitHub Release
350352 needs : build-unsigned-ipa
351353 if : needs.build-unsigned-ipa.outputs.release_exists == 'false'
352354 runs-on : ubuntu-latest
@@ -388,6 +390,7 @@ jobs:
388390 shell : bash
389391
390392 create-app-source-json :
393+ name : Create or Update App Source JSON
391394 needs : build-unsigned-ipa
392395 if : needs.build-unsigned-ipa.outputs.release_exists == 'false'
393396 runs-on : ubuntu-latest
@@ -568,3 +571,165 @@ jobs:
568571 echo "Pushing apps.json to ${PAGES_REPO}:main"
569572 git push "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" HEAD:main
570573 shell : bash
574+
575+ create-developer-update :
576+ name : Create Developer Update
577+ needs : build-unsigned-ipa
578+ if : needs.build-unsigned-ipa.outputs.release_exists == 'true'
579+ runs-on : ubuntu-latest
580+ permissions :
581+ contents : write
582+ steps :
583+ - name : Checkout Repo
584+ uses : actions/checkout@v4
585+ with :
586+ fetch-depth : 0
587+ persist-credentials : true
588+
589+ - name : Install jq and GitHub CLI
590+ run : |
591+ sudo apt update
592+ # jq
593+ if ! command -v jq >/dev/null 2>&1; then
594+ sudo apt install jq -y || true
595+ fi
596+ # gh
597+ if ! command -v gh >/dev/null 2>&1; then
598+ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
599+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
600+ sudo apt update
601+ sudo apt install gh -y || true
602+ fi
603+
604+ echo "jq: $(jq --version 2>/dev/null || echo 'not installed')"
605+ echo "gh: $(gh --version 2>/dev/null || echo 'not installed')"
606+
607+ - name : Download Device IPA
608+ uses : actions/download-artifact@v4
609+ with :
610+ name : com.prostoreios.prostore-unsigned-ios.ipa
611+ path : build
612+
613+ - name : Handle Developer Release
614+ env :
615+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
616+ run : |
617+ set -e
618+ DEVICE_IPA="build/com.prostoreios.prostore-unsigned-ios.ipa"
619+ DEV_IPA="build/com.prostoreios.prostore-developer-unsigned-ios.ipa"
620+ mv "$DEVICE_IPA" "$DEV_IPA"
621+
622+ TAG="developer"
623+ echo "Checking if release $TAG exists..."
624+ if gh release view "$TAG" >/dev/null 2>&1; then
625+ echo "Deleting existing $TAG release..."
626+ gh release delete "$TAG" --yes
627+ fi
628+
629+ echo "Creating new developer release..."
630+ gh release create "$TAG" \
631+ "$DEV_IPA" \
632+ --prerelease \
633+ --title "Developer Update" \
634+ --notes "" \
635+ --repo "$GITHUB_REPOSITORY"
636+
637+ - name : Update Developer Repo JSON
638+ env :
639+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
640+ VERSION : ${{ needs.build-unsigned-ipa.outputs.version }}
641+ run : |
642+ set -e
643+ REPO_FILE="developer-repo.json"
644+ DOWNLOAD_URL="https://github.com/ProStore-iOS/ProStore/releases/download/developer/com.prostoreios.prostore-developer-unsigned-ios.ipa"
645+
646+ # Function to increment patch version
647+ increment_patch() {
648+ local version="$1"
649+ IFS='.' read -r major minor patch <<< "$version"
650+ patch=$((patch + 1))
651+ echo "${major}.${minor}.${patch}"
652+ }
653+
654+ BASE_DEV=$(increment_patch "$VERSION")
655+
656+ # Determine new dev version
657+ NEW_D=1
658+ if [ -f "$REPO_FILE" ]; then
659+ CURRENT_DEV=$(jq -r '.apps[0].version // ""' "$REPO_FILE")
660+ if [[ $CURRENT_DEV =~ ^([0-9]+\.[0-9]+\.[0-9]+)d([0-9]+)$ ]]; then
661+ CURRENT_BASE="${BASH_REMATCH[1]}"
662+ CURRENT_D="${BASH_REMATCH[2]}"
663+ if [ "$CURRENT_BASE" == "$BASE_DEV" ]; then
664+ NEW_D=$((CURRENT_D + 1))
665+ fi
666+ fi
667+ fi
668+
669+ NEW_VERSION="${BASE_DEV}d${NEW_D}"
670+
671+ # Create or update JSON (always replace with single version)
672+ jq -n \
673+ --arg name "ProStore Developer Repo" \
674+ --arg appname "ProStore Developer" \
675+ --arg version "$NEW_VERSION" \
676+ --arg url "$DOWNLOAD_URL" \
677+ '{
678+ "name": $name,
679+ "apps": [
680+ {
681+ "name": $appname,
682+ "version": $version,
683+ "downloadURL": $url
684+ }
685+ ]
686+ }' > "$REPO_FILE"
687+
688+ # Safe commit & push
689+ git config user.name "github-actions"
690+ git config user.email "github-actions@github.com"
691+ git add "$REPO_FILE"
692+ git commit -m "Update ProStore developer repo to $NEW_VERSION" || echo "No changes to commit"
693+
694+ git fetch origin main --quiet
695+ if git rev-parse --verify origin/main >/dev/null 2>&1; then
696+ if git rebase origin/main; then
697+ echo "Rebase succeeded, pushing changes..."
698+ git push origin HEAD:main
699+ else
700+ echo "Rebase failed — aborting rebase and skipping push."
701+ git rebase --abort || true
702+ fi
703+ else
704+ git push origin HEAD:main
705+ fi
706+
707+ - name : Push Developer JSON to GitHub Pages
708+ env :
709+ PAGES_PAT : ${{ secrets.PAGES_PAT }}
710+ run : |
711+ set -e
712+ PAGES_REPO="ProStore-iOS/ProStore-iOS.github.io"
713+ PAGES_DIR=$(mktemp -d)
714+
715+ echo "Cloning pages repo (masked token)..."
716+ git clone --depth 1 "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" "$PAGES_DIR"
717+
718+ echo "Copying developer-repo.json -> developer.json in pages repo"
719+ cp developer-repo.json "$PAGES_DIR/developer.json"
720+
721+ cd "$PAGES_DIR"
722+ git config user.name "github-actions[bot]"
723+ git config user.email "github-actions[bot]@users.noreply.github.com"
724+
725+ # Only commit if there's a change
726+ git add developer.json
727+ if git diff --quiet --cached; then
728+ echo "No changes to developer.json — nothing to commit/push."
729+ exit 0
730+ fi
731+
732+ git commit -m "Update developer.json from ProStore developer build"
733+ echo "Pushing developer.json to ${PAGES_REPO}:main"
734+ git push "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" HEAD:main
735+ shell : bash
0 commit comments