refactor: merge workflow scripts
This commit is contained in:
parent
82e3c078dd
commit
0b929c9bf0
2 changed files with 16 additions and 150 deletions
142
.github/workflows/build.yml
vendored
142
.github/workflows/build.yml
vendored
|
|
@ -1,142 +0,0 @@
|
||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
ipa_url:
|
|
||||||
description: "Direct link to the decrypted IPA"
|
|
||||||
default: ""
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-tweak:
|
|
||||||
runs-on: macos-14
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Download Tweak
|
|
||||||
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-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:
|
|
||||||
path: ${{ github.workspace }}/theos
|
|
||||||
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: |
|
|
||||||
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: ${{ env.DEB_PATH }}
|
|
||||||
|
|
||||||
- name: Upload rootless package
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: rootless package
|
|
||||||
path: ${{ env.ROOTLESS_DEB_PATH }}
|
|
||||||
|
|
||||||
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 Discord IPA
|
|
||||||
run: |
|
|
||||||
curl -L -o discord.ipa ${{ github.event.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: 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
|
|
||||||
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
|
|
||||||
run: |
|
|
||||||
cyan -duws -i discord.ipa -o ${{ github.workspace }}/${{ env.APP_NAME }}.ipa -f ${{ github.workspace }}/${{ env.DEB_FILE_NAME }}
|
|
||||||
|
|
||||||
- name: Upload ipa as artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ipa
|
|
||||||
path: ${{ github.workspace }}/${{ env.APP_NAME }}.ipa
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
name: Release
|
name: Deploy
|
||||||
|
run-name: ${{ github.event.inputs.release == true && 'Release' || 'Build' }} for ${{ github.event.inputs.ipa_url }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -8,10 +9,15 @@ on:
|
||||||
default: ""
|
default: ""
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
release:
|
||||||
|
description: 'Release the build'
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-tweak:
|
build-tweak:
|
||||||
runs-on: macos-14
|
runs-on: macos-14
|
||||||
|
|
@ -123,7 +129,13 @@ jobs:
|
||||||
ROOTLESS_DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm64.deb"
|
ROOTLESS_DEB_FILE_NAME="${PACKAGE}_${VERSION}_iphoneos-arm64.deb"
|
||||||
echo "ROOTLESS_DEB_FILE_NAME=$ROOTLESS_DEB_FILE_NAME" >> $GITHUB_ENV
|
echo "ROOTLESS_DEB_FILE_NAME=$ROOTLESS_DEB_FILE_NAME" >> $GITHUB_ENV
|
||||||
echo "APP_NAME=$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
|
- name: Install cyan
|
||||||
run: pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip Pillow
|
run: pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip Pillow
|
||||||
|
|
||||||
|
|
@ -131,12 +143,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cyan -duws -i discord.ipa -o ${{ github.workspace }}/${{ env.APP_NAME }}.ipa -f ${{ github.workspace }}/${{ env.DEB_FILE_NAME }}
|
cyan -duws -i discord.ipa -o ${{ github.workspace }}/${{ env.APP_NAME }}.ipa -f ${{ github.workspace }}/${{ env.DEB_FILE_NAME }}
|
||||||
|
|
||||||
- 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 ${{ github.workspace }}/${{ env.APP_NAME }}.ipa -o ${{ github.workspace }}/${{ env.APP_NAME }}.ipa -i ./ipa-icons.zip
|
|
||||||
|
|
||||||
- name: Upload ipa as artifact
|
- name: Upload ipa as artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -144,6 +150,7 @@ jobs:
|
||||||
path: ${{ github.workspace }}/${{ env.APP_NAME }}.ipa
|
path: ${{ github.workspace }}/${{ env.APP_NAME }}.ipa
|
||||||
|
|
||||||
release-app:
|
release-app:
|
||||||
|
if: ${{ github.event.inputs.release == true }}
|
||||||
runs-on: macos-14
|
runs-on: macos-14
|
||||||
needs: build-ipa
|
needs: build-ipa
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -190,6 +197,7 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
app-repo:
|
app-repo:
|
||||||
|
if: ${{ github.event.inputs.release == true }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
runs-on: macos-14
|
runs-on: macos-14
|
||||||
needs: release-app
|
needs: release-app
|
||||||
Loading…
Add table
Reference in a new issue