Skip to content

Commit

Permalink
fix(ci): use gh cli to prevent rate limit, fix patcher link
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Jun 27, 2024
1 parent 98a64b2 commit 8659b60
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Release

on:
workflow_dispatch:
Expand All @@ -9,6 +9,9 @@ on:
required: true
type: string

env:
GH_TOKEN: ${{ github.token }}

jobs:
build-tweak:
runs-on: macos-14
Expand All @@ -23,13 +26,13 @@ jobs:
run: |
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"
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
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
Expand Down Expand Up @@ -99,8 +102,11 @@ jobs:

- name: Download and Unzip Orion
run: |
curl -L -o Orion.zip $(curl -s https://api.github.com/repos/theos/orion/releases/latest | jq -r '.assets[0].browser_download_url')
latest_release_info=$(gh api --header 'Accept: application/vnd.github+json' repos/theos/orion/releases/latest)
download_url=$(echo $latest_release_info | jq -r '.assets[0].browser_download_url')
curl -L -o Orion.zip "$download_url"
unzip Orion.zip
- name: Download Discord IPA
run: |
curl -L -o discord.ipa ${{ github.event.inputs.ipa_url }}
Expand All @@ -110,7 +116,7 @@ jobs:
- name: Download IPA patcher
working-directory: patcher
run: |
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.macos-arm64
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
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
default: ""
required: true
type: string


env:
GH_TOKEN: ${{ github.token }}

jobs:
build-tweak:
runs-on: macos-14
Expand All @@ -22,14 +25,14 @@ jobs:
- name: Download Tweak
run: |
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"
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
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
Expand Down Expand Up @@ -99,7 +102,9 @@ jobs:

- name: Download and Unzip Orion
run: |
curl -L -o Orion.zip $(curl -s https://api.github.com/repos/theos/orion/releases/latest | jq -r '.assets[0].browser_download_url')
latest_release_info=$(gh api --header 'Accept: application/vnd.github+json' repos/theos/orion/releases/latest)
download_url=$(echo $latest_release_info | jq -r '.assets[0].browser_download_url')
curl -L -o Orion.zip "$download_url"
unzip Orion.zip
- name: Download Discord IPA
Expand All @@ -112,7 +117,7 @@ jobs:
- name: Download IPA patcher
working-directory: patcher
run: |
curl -L -o patcher https://github.com/amsyarasyiq/bunny-ipa-patcher/releases/download/release-pyon/patcher.macos-arm64
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
Expand Down Expand Up @@ -230,3 +235,4 @@ jobs:
default_author: github_actions
message: "chore: update app-repo.json"
add: app-repo.json

0 comments on commit 8659b60

Please sign in to comment.