Update jfj.yml #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sign and Distribute IPA | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| sign-ipa: | |
| runs-on: macos-latest # Switched to macOS runner for zsign binary | |
| steps: | |
| # Step 1: Checkout the repository | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Debug directory structure | |
| - name: List Directory Structure | |
| run: | | |
| echo "Current working directory: $(pwd)" | |
| echo "Listing all files in repository:" | |
| find . -type f -ls | |
| echo "Checking for Priv folder:" | |
| find . -type d -name "Priv" || echo "Priv folder not found" | |
| # Step 3: Install dependencies and download zsign | |
| - name: Install Dependencies and Download zsign | |
| run: | | |
| brew install curl unzip libplist # Install required tools | |
| # Download and extract zsign v0.7 for macOS | |
| curl -L -o zsign-v0.7-macos-x64.zip https://github.com/zhlynn/zsign/releases/download/v0.7/zsign-v0.7-macos-x64.zip --fail --show-error | |
| if [ ! -f zsign-v0.7-macos-x64.zip ]; then | |
| echo "Error: zsign download failed" | |
| exit 1 | |
| fi | |
| unzip zsign-v0.7-macos-x64.zip -d zsign-bin | |
| if [ ! -f zsign-bin/zsign ]; then | |
| echo "Error: zsign binary not found after unzip" | |
| exit 1 | |
| fi | |
| chmod +x zsign-bin/zsign | |
| sudo mv zsign-bin/zsign /usr/local/bin/zsign | |
| # Verify zsign | |
| if ! /usr/local/bin/zsign -h >/dev/null 2>&1; then | |
| echo "Error: zsign is not executable or invalid" | |
| /usr/local/bin/zsign -h | |
| exit 1 | |
| fi | |
| echo "zsign installed successfully" | |
| /usr/local/bin/zsign -h | |
| # Step 4: Download the IPA file from Filebin | |
| - name: Download IPA File | |
| run: | | |
| curl -L -o DokkanSparking_Release_5.25.3.ipa https://filebin.net/mwoj4adth3toumo1/DokkanSparking_Release_5.25.3.ipa --fail --show-error | |
| if [ ! -f DokkanSparking_Release_5.25.3.ipa ]; then | |
| echo "Error: IPA download failed" | |
| exit 1 | |
| fi | |
| ls -lh DokkanSparking_Release_5.25.3.ipa | |
| # Step 5: Find certificate and provisioning profile | |
| - name: Locate Certificate and Provisioning Profile | |
| id: find-files | |
| run: | | |
| P12_FILE=$(find . -type f -name "*.p12" -path "*/Priv/*" | head -n 1) | |
| MOBILEPROVISION_FILE=$(find . -type f -name "*.mobileprovision" -path "*/Priv/*" | head -n 1) | |
| if [ -z "$P12_FILE" ] || [ -z "$MOBILEPROVISION_FILE" ]; then | |
| echo "Error: Could not find .p12 or .mobileprovision file in Priv folder" | |
| find . -type f -name "*.p12" -o -name "*.mobileprovision" | |
| exit 1 | |
| fi | |
| echo "p12_file=$P12_FILE" >> $GITHUB_OUTPUT | |
| echo "mobileprovision_file=$MOBILEPROVISION_FILE" >> $GITHUB_OUTPUT | |
| echo "Found .p12: $P12_FILE" | |
| echo "Found .mobileprovision: $MOBILEPROVISION_FILE" | |
| # Step 6: Sign the IPA with zsign | |
| - name: Sign IPA with zsign | |
| run: | | |
| /usr/local/bin/zsign -k "${{ steps.find-files.outputs.p12_file }}" \ | |
| -p "1234" \ | |
| -m "${{ steps.find-files.outputs.mobileprovision_file }}" \ | |
| -o signed_DokkanSparking_Release_5.25.3.ipa \ | |
| DokkanSparking_Release_5.25.3.ipa | |
| if [ ! -f signed_DokkanSparking_Release_5.25.3.ipa ]; then | |
| echo "Error: Signing failed, signed IPA not found" | |
| exit 1 | |
| fi | |
| echo "Signed IPA created: signed_DokkanSparking_Release_5.25.3.ipa" | |
| ls -lh signed_DokkanSparking_Release_5.25.3.ipa | |
| # Step 7: Create manifest for OTA installation | |
| - name: Create Manifest for OTA Installation | |
| run: | | |
| # Extract bundle ID from mobileprovision | |
| /usr/libexec/PlistBuddy -c "Print :Entitlements:application-identifier" "${{ steps.find-files.outputs.mobileprovision_file }}" > temp_bundle_id.txt | |
| BUNDLE_ID=$(cat temp_bundle_id.txt | cut -d'.' -f2-) | |
| if [ -z "$BUNDLE_ID" ]; then | |
| echo "Error: Could not extract bundle ID" | |
| exit 1 | |
| fi | |
| echo "Bundle ID: $BUNDLE_ID" | |
| # Create manifest.plist | |
| cat << EOF > manifest.plist | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>items</key> | |
| <array> | |
| <dict> | |
| <key>assets</key> | |
| <array> | |
| <dict> | |
| <key>kind</key> | |
| <string>software-package</string> | |
| <key>url</key> | |
| <string>https://github.com/${{ github.repository }}/releases/latest/download/signed_DokkanSparking_Release_5.25.3.ipa</string> | |
| </dict> | |
| </array> | |
| <key>metadata</key> | |
| <dict> | |
| <key>bundle-identifier</key> | |
| <string>$BUNDLE_ID</string> | |
| <key>bundle-version</key> | |
| <string>5.25.3</string> | |
| <key>kind</key> | |
| <string>software</string> | |
| <key>title</key> | |
| <string>DokkanSparking</string> | |
| </dict> | |
| </dict> | |
| </array> | |
| </dict> | |
| </plist> | |
| EOF | |
| cat manifest.plist | |
| # Step 8: Upload signed IPA and manifest to GitHub Releases | |
| - name: Upload to GitHub Releases | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| signed_DokkanSparking_Release_5.25.3.ipa | |
| manifest.plist | |
| tag_name: v${{ github.run_id }} | |
| name: Signed IPA Release | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 9: Generate and output OTA installation link | |
| - name: Output OTA Installation Link | |
| run: | | |
| INSTALL_LINK="itms-services://?action=download-manifest&url=https://github.com/${{ github.repository }}/releases/download/v${{ github.run_id }}/manifest.plist" | |
| echo "OTA Installation Link: $INSTALL_LINK" | |
| echo "Copy and open this link on your iOS device to install the app." | |
| echo "install_link=$INSTALL_LINK" >> $GITHUB_OUTPUT |