feat: re-use tweak if versions match (#9)

* fix: altsource spec

it would seem you accidentally broke the altsource by adding that key to the apps object

* fix: don't do this, bad, very bad

* chore: fix terminology

* chore: disable some markdownlint rules

* feat: re-use tweak if version matches

* fix: install required dependencies

* fix: use correct patcher for operating system

* chore: read info.plist

* fix: remove trailing comma in json

* chore: uncomment last step

* fix: oopsie

* fix: additional artifact paths

* fix: path

* chore: something broke

* chore: adjust paths

* chore: finalize

* chore: lint newlines

* chore: lint
This commit is contained in:
Adrian Castro 2024-06-24 14:50:47 +02:00 • committed by GitHub
parent b0b4838c6f
commit 90dfe9c6f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 125 additions and 47 deletions

View file

@ -11,7 +11,7 @@ on:
jobs:
build-tweak:
runs-on: macos-14
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -19,11 +19,35 @@ jobs:
with:
submodules: true
- name: Check cache
- name: Download Tweak
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
set -e
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
if [ "$status_code" -ne 200 ]; then
echo "No releases found or request failed"
echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV
exit 0
fi
release_info=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest)
release_version=$(echo "$release_info" | jq -r '.assets[] | select(.name | contains("iphoneos-arm.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(".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:
@ -31,28 +55,37 @@ jobs:
key: ${{ runner.os }}-${{ env.upstream_heads }}
- name: Prepare Theos
if: env.DEB_DOWNLOADED == 'false'
uses: Randomblock1/theos-action@v1
- name: Build packages
if: env.DEB_DOWNLOADED == 'false'
run: make package FINALPACKAGE=1 && make package FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless
- name: Set DEB path
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
if [ "${{ env.DEB_DOWNLOADED }}" == "true" ]; then
echo "DEB_PATH=${{ github.workspace }}/*-arm.deb" >> $GITHUB_ENV
echo "ROOTLESS_DEB_PATH=${{ github.workspace }}/*-arm64.deb" >> $GITHUB_ENV
else
echo "DEB_PATH=${{ github.workspace }}/packages/*-arm.deb" >> $GITHUB_ENV
echo "ROOTLESS_DEB_PATH=${{ github.workspace }}/packages/*-arm64.deb" >> $GITHUB_ENV
fi
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: "package"
path: ${{ github.workspace }}/packages/*-arm.deb
name: package
path: ${{ env.DEB_PATH }}
- name: Upload rootless package
uses: actions/upload-artifact@v4
with:
name: "rootless package"
path: ${{ github.workspace }}/packages/*-arm64.deb
name: rootless package
path: ${{ env.ROOTLESS_DEB_PATH }}
build-ipa:
runs-on: macos-14
runs-on: ubuntu-latest
needs: build-tweak
steps:
@ -64,23 +97,23 @@ jobs:
with:
merge-multiple: true
- name: Install dependencies
run: sudo apt update && sudo apt install libplist-utils xmlstarlet libxml2-utils -y
- 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
curl -L -o Orion.zip $(curl -s https://api.github.com/repos/theos/orion/releases/latest | jq -r '.assets[0].browser_download_url')
unzip Orion.zip
- name: Download Discord IPA
run: |
curl -L -o discord.ipa ${{ github.event.inputs.ipa_url }}
- name: Make patcher directory
run: |
mkdir patcher
run: mkdir patcher
- name: Download IPA patcher
working-directory: patcher
run: |
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.mac-amd64
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.linux-amd64
chmod +x patcher
- name: Download IPA icons
@ -101,7 +134,7 @@ jobs:
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 }}
./Azule/azule -i discord.ipa -o ${{ github.workspace }}/build -f $(find ${{ github.workspace }} -name 'dev.theos.orion14_*_iphoneos-arm.deb' | head -n 1) ${{ github.workspace }}/${{ env.DEB_FILE_NAME }}
mv "${{ github.workspace }}/build/"*.ipa "${{ github.workspace }}/build/${{ env.APP_NAME }}.ipa"
- name: Patch Discord

View file

@ -11,7 +11,7 @@ on:
jobs:
build-tweak:
runs-on: macos-14
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -19,11 +19,35 @@ jobs:
with:
submodules: true
- name: Check cache
- name: Download Tweak
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
set -e
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
if [ "$status_code" -ne 200 ]; then
echo "No releases found or request failed"
echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV
exit 0
fi
release_info=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest)
release_version=$(echo "$release_info" | jq -r '.assets[] | select(.name | contains("iphoneos-arm.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(".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:
@ -31,28 +55,37 @@ jobs:
key: ${{ runner.os }}-${{ env.upstream_heads }}
- name: Prepare Theos
if: env.DEB_DOWNLOADED == 'false'
uses: Randomblock1/theos-action@v1
- name: Build packages
if: env.DEB_DOWNLOADED == 'false'
run: make package FINALPACKAGE=1 && make package FINALPACKAGE=1 THEOS_PACKAGE_SCHEME=rootless
- name: Set DEB path
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
if [ "${{ env.DEB_DOWNLOADED }}" == "true" ]; then
echo "DEB_PATH=${{ github.workspace }}/*-arm.deb" >> $GITHUB_ENV
echo "ROOTLESS_DEB_PATH=${{ github.workspace }}/*-arm64.deb" >> $GITHUB_ENV
else
echo "DEB_PATH=${{ github.workspace }}/packages/*-arm.deb" >> $GITHUB_ENV
echo "ROOTLESS_DEB_PATH=${{ github.workspace }}/packages/*-arm64.deb" >> $GITHUB_ENV
fi
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: "package"
path: ${{ github.workspace }}/packages/*-arm.deb
name: package
path: ${{ env.DEB_PATH }}
- name: Upload rootless package
uses: actions/upload-artifact@v4
with:
name: "rootless package"
path: ${{ github.workspace }}/packages/*-arm64.deb
name: rootless package
path: ${{ env.ROOTLESS_DEB_PATH }}
build-ipa:
runs-on: macos-14
runs-on: ubuntu-latest
needs: build-tweak
steps:
@ -64,9 +97,12 @@ jobs:
with:
merge-multiple: true
- name: Install dependencies
run: sudo apt update && sudo apt install libplist-utils xmlstarlet libxml2-utils -y
- 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
curl -L -o Orion.zip $(curl -s https://api.github.com/repos/theos/orion/releases/latest | jq -r '.assets[0].browser_download_url')
unzip Orion.zip
- name: Download Discord IPA
@ -74,13 +110,12 @@ jobs:
curl -L -o discord.ipa ${{ github.event.inputs.ipa_url }}
- name: Make patcher directory
run: |
mkdir patcher
run: mkdir patcher
- name: Download IPA patcher
working-directory: patcher
run: |
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.mac-amd64
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.linux-amd64
chmod +x patcher
- name: Download IPA icons
@ -103,7 +138,7 @@ jobs:
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 }}
./Azule/azule -i discord.ipa -o ${{ github.workspace }}/build -f $(find ${{ github.workspace }} -name 'dev.theos.orion14_*_iphoneos-arm.deb' | head -n 1) ${{ github.workspace }}/${{ env.DEB_FILE_NAME }}
mv "${{ github.workspace }}/build/"*.ipa "${{ github.workspace }}/build/${{ env.APP_NAME }}.ipa"
- name: Patch Discord
@ -121,7 +156,7 @@ jobs:
path: ${{ github.workspace }}/build/${{ env.APP_NAME }}.ipa
release-app:
runs-on: macos-14
runs-on: ubuntu-latest
needs: build-ipa
permissions:
contents: write
@ -146,14 +181,17 @@ jobs:
with:
merge-multiple: true
- name: Install dependencies
run: sudo apt update && sudo apt install libplist-utils xmlstarlet libxml2-utils -y
- name: Extract Discord Version
run: |
unzip -q ${{ env.APP_NAME }}.ipa
DISCORD_VERSION=$(plutil -p Payload/Discord.app/Info.plist | grep CFBundleShortVersionString | cut -d '"' -f 4)
DISCORD_VERSION=$(xmllint --xpath 'string(//key[. = "CFBundleShortVersionString"]/following-sibling::string[1])' Payload/Discord.app/Info.plist)
echo "DISCORD_VERSION=$DISCORD_VERSION" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.DISCORD_VERSION }}
files: |
@ -168,7 +206,7 @@ jobs:
app-repo:
continue-on-error: true
runs-on: macos-14
runs-on: ubuntu-latest
needs: release-app
steps:
- name: Checkout code
@ -178,27 +216,26 @@ jobs:
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: Install dependencies
run: sudo apt update && sudo apt install libplist-utils xmlstarlet libxml2-utils -y
- 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)
VERSION=$(xmllint --xpath 'string(//key[. = "CFBundleShortVersionString"]/following-sibling::string[1])' Payload/Discord.app/Info.plist)
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" '.apps[0].versions |= [$newEntry] + .' app-repo.json > temp.json && mv temp.json app-repo.json
jq '.apps[0].downloadURL = "'$DOWNLOAD_URL'"' 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

7
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"markdownlint.config": {
"MD029": false,
"MD033": false,
"MD045": false,
}
}

View file

@ -15,8 +15,10 @@ Builds can be found in the [Releases](https://github.com/pyoncord/BunnyTweak/rel
1. Install the Orion runtime via your preferred package manager, by adding `https://repo.chariz.com/` to your sources, then finding `Orion Runtime`.
1. Install Bunny by downloading the appropriate `.deb` file (or by building your own, see [Building BunnyTweak locally](#building-bunnytweak-locally)). Use the file ending in `arm.deb` for rootful jailbreaks, and the file ending in `arm64.deb` for rootless jailbreaks.
### Non-Jailbroken
### Jailed
<a href="https://tinyurl.com/yh455zk6"><img src="https://i.imgur.com/46qhEAv.png" width="230"></a>
1. Download and install `Bunny.ipa` using your preferred sideloading method.
## Building BunnyTweak locally

View file

@ -37,8 +37,7 @@
"downloadURL": "https://github.com/pyoncord/BunnyTweak/releases/download/v223.0/Pyoncord.ipa"
}
],
"appPermissions": {},
"downloadURL": "https://github.com/pyoncord/BunnyTweak/releases/download/v230.0/Bunny.ipa"
"appPermissions": {}
}
],
"news": []