Skip to content

Commit 6da169a

Browse files
authored
Refactor GitHub Actions for IPA build and release
1 parent 532126d commit 6da169a

File tree

1 file changed

+131
-130
lines changed

1 file changed

+131
-130
lines changed

.github/workflows/build-ipa.yml

Lines changed: 131 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -466,138 +466,139 @@ jobs:
466466
path: signed-ipas/*.ipa
467467

468468
create-github-release:
469-
name: Create GitHub Release
470-
needs: [build-unsigned-ipa, sign-ipas]
471-
if: needs.build-ipa.outputs.release_exists == 'false'
472-
runs-on: ubuntu-latest
473-
steps:
474-
- name: Install GitHub CLI
475-
run: |
476-
if ! command -v gh >/dev/null 2>&1; then
477-
echo "gh not found — attempting official installer script"
478-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
479-
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
480-
sudo apt update
481-
sudo apt install gh -y || true
482-
fi
483-
echo "gh: $(gh --version 2>/dev/null || echo 'not installed')"
469+
name: Create GitHub Release
470+
needs: [build-unsigned-ipa, sign-ipas]
471+
# job-level if must use expression syntax and reference the correct job id
472+
if: ${{ needs.build-unsigned-ipa.outputs.release_exists == 'false' }}
473+
runs-on: ubuntu-latest
474+
steps:
475+
- name: Install GitHub CLI
476+
run: |
477+
if ! command -v gh >/dev/null 2>&1; then
478+
echo "gh not found — attempting official installer script"
479+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
480+
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
481+
sudo apt update
482+
sudo apt install gh -y || true
483+
fi
484+
echo "gh: $(gh --version 2>/dev/null || echo 'not installed')"
484485
485-
- name: Download All Artifacts
486-
uses: actions/download-artifact@v4
487-
with:
488-
path: artifacts
486+
- name: Download All Artifacts
487+
uses: actions/download-artifact@v4
488+
with:
489+
path: artifacts
489490

490-
- name: Create Release
491-
env:
492-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
493-
VERSION: ${{ needs.build-unsigned-ipa.outputs.version }}
494-
CHANGELOG: ${{ needs.build-unsigned-ipa.outputs.changelog }}
495-
run: |
496-
TAG="v$VERSION"
497-
echo "Creating release $TAG with notes:"
498-
printf '%s\n' "$CHANGELOG"
499-
IPAS=$(find artifacts -type f -name '*.ipa' -print0 | xargs -0)
500-
if [ -z "$IPAS" ]; then
501-
echo "No IPAs found to upload."
502-
exit 1
503-
fi
504-
gh release create "$TAG" \
505-
$IPAS \
506-
--title "ProStore v$VERSION" \
507-
--notes "$CHANGELOG" \
508-
--repo "$GITHUB_REPOSITORY"
509-
shell: bash
491+
- name: Create Release
492+
env:
493+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
494+
VERSION: ${{ needs.build-unsigned-ipa.outputs.version }}
495+
CHANGELOG: ${{ needs.build-unsigned-ipa.outputs.changelog }}
496+
run: |
497+
TAG="v$VERSION"
498+
echo "Creating release $TAG with notes:"
499+
printf '%s\n' "$CHANGELOG"
500+
IPAS=$(find artifacts -type f -name '*.ipa' -print0 | xargs -0)
501+
if [ -z "$IPAS" ]; then
502+
echo "No IPAs found to upload."
503+
exit 1
504+
fi
505+
gh release create "$TAG" \
506+
$IPAS \
507+
--title "ProStore v$VERSION" \
508+
--notes "$CHANGELOG" \
509+
--repo "$GITHUB_REPOSITORY"
510+
shell: bash
510511

511-
update-prostore-repo-json:
512-
name: Update ProStore Repo JSON
513-
needs: build-unsigned-ipa
514-
if: needs.build-unsigned-ipa.outputs.release_exists == 'false'
515-
runs-on: ubuntu-latest
516-
env:
517-
VERSION: ${{ needs.build-unsigned-ipa.outputs.version }}
518-
CHANGELOG: ${{ needs.build-unsigned-ipa.outputs.changelog }}
519-
steps:
520-
- name: Install jq
521-
run: |
522-
if ! command -v jq >/dev/null 2>&1; then
523-
echo "jq not found — attempting to install"
524-
sudo apt update
525-
sudo apt install jq -y || true
526-
fi
527-
echo "jq: $(jq --version 2>/dev/null || echo 'not installed')"
512+
update-prostore-repo-json:
513+
name: Update ProStore Repo JSON
514+
needs: build-unsigned-ipa
515+
if: ${{ needs.build-unsigned-ipa.outputs.release_exists == 'false' }}
516+
runs-on: ubuntu-latest
517+
env:
518+
VERSION: ${{ needs.build-unsigned-ipa.outputs.version }}
519+
CHANGELOG: ${{ needs.build-unsigned-ipa.outputs.changelog }}
520+
steps:
521+
- name: Install jq
522+
run: |
523+
if ! command -v jq >/dev/null 2>&1; then
524+
echo "jq not found — attempting to install"
525+
sudo apt update
526+
sudo apt install jq -y || true
527+
fi
528+
echo "jq: $(jq --version 2>/dev/null || echo 'not installed')"
528529
529-
- name: Download Device IPA
530-
uses: actions/download-artifact@v4
531-
with:
532-
name: com.prostoreios.prostore-unsigned-ios.ipa
533-
path: build
530+
- name: Download Device IPA
531+
uses: actions/download-artifact@v4
532+
with:
533+
name: com.prostoreios.prostore-unsigned-ios.ipa
534+
path: build
534535

535-
- name: Update Apps JSON in Pages Repo
536-
env:
537-
PAGES_PAT: ${{ secrets.PAGES_PAT }}
538-
run: |
539-
set -e
540-
IPA_PATH="$PWD/build/com.prostoreios.prostore-unsigned-ios.ipa"
541-
DOWNLOAD_URL="https://github.com/ProStore-iOS/ProStore/releases/download/v$VERSION/com.prostoreios.prostore-unsigned-ios.ipa"
542-
if [ -f "$IPA_PATH" ]; then
543-
IPA_SIZE=$(stat -c%s "$IPA_PATH")
544-
SHA256=$(sha256sum "$IPA_PATH" | awk '{print $1}')
545-
else
546-
IPA_SIZE=0
547-
SHA256=""
548-
fi
549-
VERSION_DATE_ISO=$(date -u +"%Y-%m-%dT%H:%M:%S%z")
550-
MIN_OS="16.0"
551-
FULL_DATE=$(date +%Y%m%d%H%M%S)
552-
ICON_URL="https://raw.githubusercontent.com/ProStore-iOS/ProStore-iOS.github.io/refs/heads/main/ProStore_icon.png"
553-
BUNDLE="com.prostoreios.prostore"
554-
META_DESC="The BEST alternative app store for iOS!"
555-
DEVNAME="ProStore iOS"
556-
SCREENSHOTS='["https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot1.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot2.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot3.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot4.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot5.png"]'
557-
PAGES_REPO="ProStore-iOS/ProStore-iOS.github.io"
558-
PAGES_DIR=$(mktemp -d)
559-
git clone --depth 1 "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" "$PAGES_DIR"
560-
cd "$PAGES_DIR"
561-
REPO_FILE="apps.json"
562-
if [ ! -f "$REPO_FILE" ]; then
563-
jq -n --arg icon "$ICON_URL" '{
564-
name: "Official ProStore Repo",
565-
identifier: "com.prostoreios.prostore.repo",
566-
sourceURL: "https://ProStore-iOS.github.io/apps.json",
567-
iconURL: $icon,
568-
website: "https://ProStore-iOS.github.io",
569-
subtitle: "The BEST alternative app store for iOS!",
570-
apps: []
571-
}' > "$REPO_FILE"
572-
fi
573-
TMP=$(mktemp)
574-
NEW_VERSION=$(jq -c -n \
575-
--arg version "$VERSION" \
576-
--arg date "$VERSION_DATE_ISO" \
577-
--arg desc "$CHANGELOG" \
578-
--arg url "$DOWNLOAD_URL" \
579-
--arg sha "$SHA256" \
580-
--arg minos "$MIN_OS" \
581-
--arg fulldate "$FULL_DATE" \
582-
--argjson size "$IPA_SIZE" \
583-
'{version: $version, date: $date, localizedDescription: $desc, downloadURL: $url, size: $size, sha256: $sha, minOSVersion: $minos, fullDate: $fulldate}')
584-
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'
585-
jq --argjson newVer "$NEW_VERSION" \
586-
--arg name "ProStore" \
587-
--arg bundle "$BUNDLE" \
588-
--arg dev "$DEVNAME" \
589-
--arg appdesc "$META_DESC" \
590-
--arg icon "$ICON_URL" \
591-
--argjson screenshots "$SCREENSHOTS" \
592-
"$JQ_QUERY" "$REPO_FILE" > "$TMP" && mv "$TMP" "$REPO_FILE"
593-
git config user.name "github-actions[bot]"
594-
git config user.email "github-actions[bot]@users.noreply.github.com"
595-
git add "$REPO_FILE"
596-
if git diff --quiet --cached; then
597-
echo "No changes to apps.json — nothing to commit/push."
598-
exit 0
599-
fi
600-
git commit -m "Update apps.json for ProStore v${VERSION}"
601-
echo "Pushing apps.json to ${PAGES_REPO}:main"
602-
git push "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" HEAD:main
603-
shell: bash
536+
- name: Update Apps JSON in Pages Repo
537+
env:
538+
PAGES_PAT: ${{ secrets.PAGES_PAT }}
539+
run: |
540+
set -e
541+
IPA_PATH="$PWD/build/com.prostoreios.prostore-unsigned-ios.ipa"
542+
DOWNLOAD_URL="https://github.com/ProStore-iOS/ProStore/releases/download/v$VERSION/com.prostoreios.prostore-unsigned-ios.ipa"
543+
if [ -f "$IPA_PATH" ]; then
544+
IPA_SIZE=$(stat -c%s "$IPA_PATH")
545+
SHA256=$(sha256sum "$IPA_PATH" | awk '{print $1}')
546+
else
547+
IPA_SIZE=0
548+
SHA256=""
549+
fi
550+
VERSION_DATE_ISO=$(date -u +"%Y-%m-%dT%H:%M:%S%z")
551+
MIN_OS="16.0"
552+
FULL_DATE=$(date +%Y%m%d%H%M%S)
553+
ICON_URL="https://raw.githubusercontent.com/ProStore-iOS/ProStore-iOS.github.io/refs/heads/main/ProStore_icon.png"
554+
BUNDLE="com.prostoreios.prostore"
555+
META_DESC="The BEST alternative app store for iOS!"
556+
DEVNAME="ProStore iOS"
557+
SCREENSHOTS='["https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot1.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot2.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot3.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot4.png","https://raw.githubusercontent.com/ProStore-iOS/ProStore/refs/heads/main/gallery/Screenshot5.png"]'
558+
PAGES_REPO="ProStore-iOS/ProStore-iOS.github.io"
559+
PAGES_DIR=$(mktemp -d)
560+
git clone --depth 1 "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" "$PAGES_DIR"
561+
cd "$PAGES_DIR"
562+
REPO_FILE="apps.json"
563+
if [ ! -f "$REPO_FILE" ]; then
564+
jq -n --arg icon "$ICON_URL" '{
565+
name: "Official ProStore Repo",
566+
identifier: "com.prostoreios.prostore.repo",
567+
sourceURL: "https://ProStore-iOS.github.io/apps.json",
568+
iconURL: $icon,
569+
website: "https://ProStore-iOS.github.io",
570+
subtitle: "The BEST alternative app store for iOS!",
571+
apps: []
572+
}' > "$REPO_FILE"
573+
fi
574+
TMP=$(mktemp)
575+
NEW_VERSION=$(jq -c -n \
576+
--arg version "$VERSION" \
577+
--arg date "$VERSION_DATE_ISO" \
578+
--arg desc "$CHANGELOG" \
579+
--arg url "$DOWNLOAD_URL" \
580+
--arg sha "$SHA256" \
581+
--arg minos "$MIN_OS" \
582+
--arg fulldate "$FULL_DATE" \
583+
--argjson size "$IPA_SIZE" \
584+
'{version: $version, date: $date, localizedDescription: $desc, downloadURL: $url, size: $size, sha256: $sha, minOSVersion: $minos, fullDate: $fulldate}')
585+
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'
586+
jq --argjson newVer "$NEW_VERSION" \
587+
--arg name "ProStore" \
588+
--arg bundle "$BUNDLE" \
589+
--arg dev "$DEVNAME" \
590+
--arg appdesc "$META_DESC" \
591+
--arg icon "$ICON_URL" \
592+
--argjson screenshots "$SCREENSHOTS" \
593+
"$JQ_QUERY" "$REPO_FILE" > "$TMP" && mv "$TMP" "$REPO_FILE"
594+
git config user.name "github-actions[bot]"
595+
git config user.email "github-actions[bot]@users.noreply.github.com"
596+
git add "$REPO_FILE"
597+
if git diff --quiet --cached; then
598+
echo "No changes to apps.json — nothing to commit/push."
599+
exit 0
600+
fi
601+
git commit -m "Update apps.json for ProStore v${VERSION}"
602+
echo "Pushing apps.json to ${PAGES_REPO}:main"
603+
git push "https://x-access-token:${PAGES_PAT}@github.com/${PAGES_REPO}.git" HEAD:main
604+
shell: bash

0 commit comments

Comments
 (0)