From 04bf575db97277f3cd301c19cfc7a5a54e17a16e Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:01:36 +0200 Subject: [PATCH] feat: release workflow & app repo (#3) * feat: release workflow * feat: app repo * chore: add badge for app repo * fix: idiotism * chore: only add modified file --- .github/workflows/release.yml | 161 ++++++++++++++++++++++++++++++++++ README.md | 8 +- app-repo.json | 17 ++++ control | 6 +- 4 files changed, 184 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 app-repo.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..429100b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,161 @@ +name: Release Pyoncord + +on: + workflow_dispatch: + inputs: + ipa_url: + description: "Direct link to the decrypted IPA" + default: "" + required: true + type: string + +jobs: + build-tweak: + runs-on: macos-14 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Check cache + 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 + id: cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/theos + key: ${{ runner.os }}-${{ env.upstream_heads }} + + - name: Prepare Theos + uses: Randomblock1/theos-action@v1 + + - name: Build packages + run: | + export PATH="$(brew --prefix make)/libexec/gnubin:$PATH" + export THEOS="${{ github.workspace }}/theos" + rm -rf packages && make clean && make package FINALPACKAGE=1 && make package FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless + + - name: Upload package + uses: actions/upload-artifact@v4 + with: + name: "package" + path: ${{ github.workspace }}/packages/*-arm.deb + + - name: Upload rootless package + uses: actions/upload-artifact@v4 + with: + name: "rootless package" + path: ${{ github.workspace }}/packages/*-arm64.deb + + build-ipa: + runs-on: macos-14 + 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 and Unzip Orion + run: | + curl -L -o Orion.zip https://github.com/theos/orion/releases/download/1.0.1/Orion_1.0.1.zip + unzip Orion.zip + + - name: Download Discord IPA + run: | + curl -L -o discord.ipa ${{ github.event.inputs.ipa_url }} + + - name: Extract Package and Version + run: | + PACKAGE=$(grep '^Package:' control | cut -d ' ' -f 2) + VERSION=$(grep '^Version:' control | cut -d ' ' -f 2) + DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm.deb" + echo "DEB_FILE_NAME=$DEB_FILE_NAME" >> $GITHUB_ENV + + - name: Inject tweak + run: | + mkdir -p ${{ github.workspace }}/build + git clone https://github.com/Al4ise/Azule.git + ./Azule/azule -i discord.ipa -o ${{ github.workspace }}/build -f ${{ github.workspace }}/dev.theos.orion14_1.0.1_iphoneos-arm.deb ${{ github.workspace }}/${{ env.DEB_FILE_NAME }} + mv "${{ github.workspace }}/build/"*.ipa "${{ github.workspace }}/build/Pyoncord.ipa" + + - name: Upload Pyoncord.ipa as artifact + uses: actions/upload-artifact@v4 + with: + name: ipa + path: ${{ github.workspace }}/build/Pyoncord.ipa + + release-pyoncord: + runs-on: macos-14 + needs: build-ipa + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + merge-multiple: true + + - name: Extract Package File Names and Discord Version + run: | + PACKAGE=$(grep '^Package:' control | cut -d ' ' -f 2) + VERSION=$(grep '^Version:' control | cut -d ' ' -f 2) + DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm.deb" + echo "DEB_FILE_NAME=$DEB_FILE_NAME" >> $GITHUB_ENV + ROOTLESS_DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm64.deb" + echo "ROOTLESS_DEB_FILE_NAME=$ROOTLESS_DEB_FILE_NAME" >> $GITHUB_ENV + unzip -q Pyoncord.ipa + DISCORD_VERSION=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleShortVersionString | cut -d '"' -f 4) + echo "DISCORD_VERSION=$DISCORD_VERSION" >> $GITHUB_ENV + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ env.DISCORD_VERSION }} + files: | + ${{ env.DEB_FILE_NAME }} + ${{ env.ROOTLESS_DEB_FILE_NAME }} + Pyoncord.ipa + generate_release_notes: true + fail_on_unmatched_files: true + token: ${{ env.GITHUB_TOKEN }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + app-repo: + continue-on-error: true + runs-on: macos-14 + needs: release-pyoncord + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download IPA artifact + uses: actions/download-artifact@v4 + with: + name: ipa + + - name: Update app-repo.json + run: | + unzip -q Pyoncord.ipa + VERSION=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleShortVersionString | cut -d '"' -f 4) + DATE=$(date -u +"%Y-%m-%d") + IPA_SIZE=$(ls -l Pyoncord.ipa | awk '{print $5}') + NEW_ENTRY=$(jq -n --arg version "$VERSION" --arg date "$DATE" --arg size "$IPA_SIZE" --arg downloadURL "https://github.com/pyoncord/PyoncordTweak/releases/download/v$VERSION/Pyoncord.ipa" '{version: $version, date: $date, size: ($size | tonumber), downloadURL: $downloadURL}') + jq --argjson newEntry "$NEW_ENTRY" '.apps[0].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 \ No newline at end of file diff --git a/README.md b/README.md index cba5478..49fa4ff 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,10 @@ -> [!NOTE] -> This tweak was desperately forked from VendettaTweak. I may not have the expertise to maintain or expand this tweak beyond its current state - # PyoncordTweak A rootful/rootless tweak to inject [Pyoncord](https://github.com/pyoncord/Pyoncord) into Discord. Forked [VendettaTweak](https://github.com/vendetta-mod/VendettaTweak), modified to match with [PyoncordXposed](https://github.com/pyoncord/PyoncordXposed) behavior. There are still slight differences between these two, and this tweak may be missing some loader features. ## Installation -Builds can be found in the [Actions](https://github.com/pyoncord/PyoncordTweak/actions/workflows/build.yml) tab. +Builds can be found in the [Releases](https://github.com/pyoncord/PyoncordTweak/releases/latest) tab. ### Jailbroken (Rootful/Rootless) @@ -15,7 +12,7 @@ Builds can be found in the [Actions](https://github.com/pyoncord/PyoncordTweak/a 1. Install Pyoncord by downloading the appropriate `.deb` file (or by building your own, see [Building PyoncordTweak locally](#building-pyoncordtweak-locally)). Use the file ending in `arm.deb` for rootful jailbreaks, and the file ending in `arm64.deb` for rootless jailbreaks. ### Non-Jailbroken - + 1. Download and install `Pyoncord.ipa` using your preferred sideloading method. ## Building PyoncordTweak locally @@ -58,3 +55,4 @@ The resulting `.deb` files will be in the `packages` folder. As a reminder, `*ar If you want to contribute, you will basically need to follow the steps for [Building PyoncordTweak locally](#building-pyoncordtweak-locally), as well as run `make spm` for the Swift LSP to work. + diff --git a/app-repo.json b/app-repo.json new file mode 100644 index 0000000..1de119b --- /dev/null +++ b/app-repo.json @@ -0,0 +1,17 @@ +{ + "name": "Pyoncord App Repo", + "apps": [ + { + "name": "Pyoncord", + "bundleIdentifier": "com.pyoncord.pyoncord", + "developerName": "Pylix", + "iconURL": "", + "localizedDescription": "A client mod for Discord", + "subtitle": "A client mod for Discord", + "tintColor": "7289da", + "versions": [], + "appPermissions": {} + } + ], + "news": [] +} diff --git a/control b/control index 71003db..6fc22c2 100644 --- a/control +++ b/control @@ -1,9 +1,9 @@ -Package: com.pyoncord.bunny -Name: bunny +Package: com.pyoncord.pyoncord +Name: pyoncord Version: 0.0.1 Architecture: iphoneos-arm Description: A mod for Discord's mobile apps. -Maintainer: FieryFlames +Maintainer: Pylix Author: FieryFlames Icon: https://avatars.githubusercontent.com/u/112445065 Section: Tweaks