forked from bunny-mod/BunnyTweak
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (170 loc) · 7.05 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Release
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: Make patcher directory
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
chmod +x patcher
- name: Download IPA icons
working-directory: patcher
run: |
curl -L -o ipa-icons.zip https://raw.githubusercontent.com/pyoncord/assets/main/ipa-icons.zip
- 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)
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
echo "APP_NAME=$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/${{ env.APP_NAME }}.ipa"
- name: Patch Discord
working-directory: patcher
run : |
./patcher \
-d ${{ github.workspace }}/build/${{ env.APP_NAME }}.ipa \
-o ${{ github.workspace }}/build/${{ env.APP_NAME }}.ipa \
-i ./ipa-icons.zip
- name: Upload ipa as artifact
uses: actions/upload-artifact@v4
with:
name: ipa
path: ${{ github.workspace }}/build/${{ env.APP_NAME }}.ipa
release-app:
runs-on: macos-14
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)
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
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
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 }}
${{ env.APP_NAME }}.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-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)
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