This repository was archived by the owner on May 5, 2025. It is now read-only.
Release for https://ipa.aspy.dev/discord/stable/Discord_266.0.ipa #15
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: Deploy Build | |
| run-name: ${{ github.event.inputs.release == 'true' && 'Release' || 'Build' }} for ${{ github.event.inputs.ipa_url }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ipa_url: | |
| default: "" | |
| description: "Direct link to the decrypted IPA" | |
| required: true | |
| type: string | |
| release: | |
| description: "Release the build" | |
| required: true | |
| type: boolean | |
| is_testflight: | |
| default: false | |
| description: "TestFlight build" | |
| required: true | |
| type: boolean | |
| workflow_call: | |
| inputs: | |
| ipa_url: | |
| required: true | |
| type: string | |
| is_testflight: | |
| required: true | |
| type: boolean | |
| release: | |
| required: false | |
| type: boolean | |
| default: true | |
| caller_workflow: | |
| required: false | |
| type: string | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| jobs: | |
| build-tweak: | |
| runs-on: macos-15 | |
| env: | |
| DEB_DOWNLOADED: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Download Tweak | |
| if: inputs.caller_workflow != 'ci' | |
| run: | | |
| set +e | |
| release_info=$(gh api --header 'Accept: application/vnd.github+json' repos/${{ github.repository }}/releases/latest) | |
| status_code=$(echo $release_info | jq -r ".status") | |
| if [ "$status_code" != "null" ]; then | |
| echo "No releases found or request failed, status code: $status_code" | |
| echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV | |
| exit 0 | |
| fi | |
| set -e | |
| release_version=$(echo "$release_info" | jq -r '.assets[] | select(.name | contains("iphoneos-arm64.deb")) | .name' | grep -o '_[0-9.]\+_' | tr -d '_') | |
| control_version=$(grep '^Version:' control | cut -d ' ' -f 2) | |
| if [ "$release_version" = "$control_version" ]; then | |
| echo "Versions match. Downloading DEB files..." | |
| echo "$release_info" | jq -r '.assets[] | select(.name | endswith("arm64.deb")) | .browser_download_url' | xargs -I {} curl -L -O {} | |
| echo "DEB_DOWNLOADED=true" >> $GITHUB_ENV | |
| else | |
| echo "Versions do not match. No files will be downloaded." | |
| echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV | |
| exit 0 | |
| fi | |
| - name: Check cache | |
| if: env.DEB_DOWNLOADED == 'false' | |
| run: echo upstream_heads=`git ls-remote https://github.com/theos/theos | head -n 1 | cut -f 1`-`git ls-remote https://github.com/theos/sdks | head -n 1 | cut -f 1` >> $GITHUB_ENV | |
| - name: Use cache | |
| if: env.DEB_DOWNLOADED == 'false' | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/theos | |
| key: ${{ runner.os }}-${{ env.upstream_heads }} | |
| - name: Prepare Theos | |
| if: env.DEB_DOWNLOADED == 'false' | |
| uses: Randomblock1/theos-action@v1 | |
| - name: Set GNU Make path | |
| run: | | |
| echo "PATH=$(brew --prefix make)/libexec/gnubin:$PATH" >> $GITHUB_ENV | |
| - name: Build packages | |
| if: env.DEB_DOWNLOADED == 'false' | |
| run: make package | |
| - name: Set DEB path | |
| run: | | |
| if [ "${{ env.DEB_DOWNLOADED }}" == "true" ]; then | |
| echo "ROOTLESS_DEB_PATH=*-arm64.deb" >> $GITHUB_ENV | |
| else | |
| echo "ROOTLESS_DEB_PATH=packages/*-arm64.deb" >> $GITHUB_ENV | |
| fi | |
| - name: Upload rootless package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: rootless package | |
| path: ${{ env.ROOTLESS_DEB_PATH }} | |
| build-ipa: | |
| if: inputs.caller_workflow != 'ci' | |
| runs-on: macos-15 | |
| needs: build-tweak | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Download Discord IPA | |
| run: | | |
| curl -L -o discord.ipa ${{ github.event.inputs.ipa_url || inputs.ipa_url }} | |
| - name: Download IPA icons | |
| run: | | |
| curl -L -o ipa-icons.zip https://raw.githubusercontent.com/pyoncord/assets/main/ipa-icons.zip | |
| - name: Clone OpenInDiscord | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: castdrian/OpenInDiscord | |
| path: OpenInDiscord | |
| - name: Build Safari Extension | |
| run: | | |
| cd OpenInDiscord | |
| xcodebuild build \ | |
| -target "OpenInDiscord Extension" \ | |
| -configuration Release \ | |
| -sdk iphoneos \ | |
| CONFIGURATION_BUILD_DIR="build" \ | |
| PRODUCT_NAME="OpenInDiscord" \ | |
| PRODUCT_BUNDLE_IDENTIFIER="com.hammerandchisel.discord.OpenInDiscord" \ | |
| PRODUCT_MODULE_NAME="OpenInDiscordExt" \ | |
| SKIP_INSTALL=NO \ | |
| DEVELOPMENT_TEAM="" \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| ONLY_ACTIVE_ARCH=NO | xcbeautify | |
| - name: Extract Values | |
| run: | | |
| NAME=$(grep '^Name:' control | cut -d ' ' -f 2) | |
| PACKAGE=$(grep '^Package:' control | cut -d ' ' -f 2) | |
| VERSION=$(grep '^Version:' control | cut -d ' ' -f 2) | |
| ROOTLESS_DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm64.deb" | |
| echo "ROOTLESS_DEB_FILE_NAME=$ROOTLESS_DEB_FILE_NAME" >> $GITHUB_ENV | |
| echo "APP_NAME=$NAME" >> $GITHUB_ENV | |
| - name: Run patcher | |
| run: | | |
| curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.mac-amd64 | |
| chmod +x patcher | |
| ./patcher -d discord.ipa -o discord.ipa -i ./ipa-icons.zip | |
| - name: Install cyan | |
| run: pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip Pillow | |
| - name: Inject tweak and extension | |
| run: | | |
| cyan -duwsgq -i discord.ipa -o ${{ env.APP_NAME }}.ipa -f ${{ env.ROOTLESS_DEB_FILE_NAME }} OpenInDiscord/build/OpenInDiscord.appex | |
| - name: Upload ipa as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ipa | |
| path: ${{ env.APP_NAME }}.ipa | |
| release-app: | |
| if: | | |
| inputs.caller_workflow != 'ci' && | |
| (github.event.inputs.release == 'true' || inputs.release == true) | |
| runs-on: macos-15 | |
| needs: build-ipa | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract Values | |
| run: | | |
| NAME=$(grep '^Name:' control | cut -d ' ' -f 2) | |
| PACKAGE=$(grep '^Package:' control | cut -d ' ' -f 2) | |
| VERSION=$(grep '^Version:' control | cut -d ' ' -f 2) | |
| ROOTLESS_DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm64.deb" | |
| echo "ROOTLESS_DEB_FILE_NAME=$ROOTLESS_DEB_FILE_NAME" >> $GITHUB_ENV | |
| echo "APP_NAME=$NAME" >> $GITHUB_ENV | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Extract Discord Version | |
| run: | | |
| unzip -q ${{ env.APP_NAME }}.ipa | |
| VERSION=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleShortVersionString | cut -d '"' -f 4) | |
| if [[ "${{ github.event.inputs.is_testflight || inputs.is_testflight }}" == "true" ]]; then | |
| BUILD=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleVersion | cut -d '"' -f 4) | |
| VERSION="${VERSION}_${BUILD}" | |
| echo "IS_PRERELEASE=true" >> $GITHUB_ENV | |
| else | |
| echo "IS_PRERELEASE=false" >> $GITHUB_ENV | |
| fi | |
| echo "DISCORD_VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ env.DISCORD_VERSION }} | |
| files: | | |
| ${{ env.ROOTLESS_DEB_FILE_NAME }} | |
| ${{ env.APP_NAME }}.ipa | |
| generate_release_notes: true | |
| prerelease: ${{ env.IS_PRERELEASE }} | |
| fail_on_unmatched_files: true | |
| token: ${{ env.GITHUB_TOKEN }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update Repository | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.WORKFLOW_DISPATCH_TOKEN }} | |
| script: | | |
| const assets = JSON.parse('${{ steps.create_release.outputs.assets }}'); | |
| const debAsset = assets.find(asset => asset.name === '${{ env.ROOTLESS_DEB_FILE_NAME }}'); | |
| if (!debAsset) { | |
| core.setFailed('Could not find DEB asset in release'); | |
| return; | |
| } | |
| await github.rest.repos.createDispatchEvent({ | |
| owner: 'castdrian', | |
| repo: 'apt-repo', | |
| event_type: 'package-update', | |
| client_payload: { | |
| package_url: debAsset.browser_download_url, | |
| package_name: '${{ env.ROOTLESS_DEB_FILE_NAME }}' | |
| } | |
| }); | |
| app-repo: | |
| if: | | |
| inputs.caller_workflow != 'ci' && | |
| (github.event.inputs.release == 'true' || inputs.release == true) | |
| continue-on-error: true | |
| runs-on: macos-15 | |
| needs: release-app | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract App Name | |
| run: | | |
| NAME=$(grep '^Name:' control | cut -d ' ' -f 2) | |
| echo "APP_NAME=$NAME" >> $GITHUB_ENV | |
| - name: Download IPA artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ipa | |
| - name: Update app-repo.json | |
| run: | | |
| unzip -q ${{ env.APP_NAME }}.ipa | |
| VERSION=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleShortVersionString | cut -d '"' -f 4) | |
| if [[ "${{ github.event.inputs.is_testflight || inputs.is_testflight }}" == "true" ]]; then | |
| BUILD=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleVersion | cut -d '"' -f 4) | |
| VERSION="${VERSION}_${BUILD}" | |
| APP_INDEX=1 | |
| else | |
| APP_INDEX=0 | |
| fi | |
| DATE=$(date -u +"%Y-%m-%d") | |
| IPA_SIZE=$(ls -l ${{ env.APP_NAME }}.ipa | awk '{print $5}') | |
| DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/v$VERSION/${{ env.APP_NAME }}.ipa | |
| NEW_ENTRY=$(jq -n --arg version "$VERSION" --arg date "$DATE" --arg size "$IPA_SIZE" --arg downloadURL "$DOWNLOAD_URL" '{version: $version, date: $date, size: ($size | tonumber), downloadURL: $downloadURL}') | |
| jq --argjson newEntry "$NEW_ENTRY" --argjson index "$APP_INDEX" '.apps[$index].versions |= [$newEntry] + .' app-repo.json > temp.json && mv temp.json app-repo.json | |
| - uses: EndBug/add-and-commit@v9 | |
| with: | |
| default_author: github_actions | |
| message: "chore: update app-repo.json" | |
| add: app-repo.json |