fix(ci): use gh cli to prevent rate limit, fix patcher link

This commit is contained in:
amsyarasyiq 2024-06-28 01:49:54 +08:00
parent 98a64b2e68
commit 8659b60d52
2 changed files with 27 additions and 15 deletions

View file

@ -1,4 +1,4 @@
name: Build name: Release
on: on:
workflow_dispatch: workflow_dispatch:
@ -9,6 +9,9 @@ on:
required: true required: true
type: string type: string
env:
GH_TOKEN: ${{ github.token }}
jobs: jobs:
build-tweak: build-tweak:
runs-on: macos-14 runs-on: macos-14
@ -23,13 +26,13 @@ jobs:
run: | run: |
set -e set -e
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/latest) release_info=$(gh api --header 'Accept: application/vnd.github+json' repos/${{ github.repository }}/releases/latest)
if [ "$status_code" -ne 200 ]; then status_code=$(echo $release_info | jq -r ".status")
echo "No releases found or request failed" if [ "$status_code" != "null" ]; then
echo "No releases found or request failed, status code: $status_code"
echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV
exit 0 exit 0
fi 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 '_') 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) control_version=$(grep '^Version:' control | cut -d ' ' -f 2)
if [ "$release_version" = "$control_version" ]; then if [ "$release_version" = "$control_version" ]; then
@ -99,8 +102,11 @@ jobs:
- name: Download and Unzip Orion - name: Download and Unzip Orion
run: | 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 unzip Orion.zip
- name: Download Discord IPA - name: Download Discord IPA
run: | run: |
curl -L -o discord.ipa ${{ github.event.inputs.ipa_url }} curl -L -o discord.ipa ${{ github.event.inputs.ipa_url }}
@ -110,7 +116,7 @@ jobs:
- name: Download IPA patcher - name: Download IPA patcher
working-directory: patcher working-directory: patcher
run: | 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 chmod +x patcher
- name: Download IPA icons - name: Download IPA icons

View file

@ -8,7 +8,10 @@ on:
default: "" default: ""
required: true required: true
type: string type: string
env:
GH_TOKEN: ${{ github.token }}
jobs: jobs:
build-tweak: build-tweak:
runs-on: macos-14 runs-on: macos-14
@ -22,14 +25,14 @@ jobs:
- name: Download Tweak - name: Download Tweak
run: | run: |
set -e set -e
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/latest) release_info=$(gh api --header 'Accept: application/vnd.github+json' repos/${{ github.repository }}/releases/latest)
if [ "$status_code" -ne 200 ]; then status_code=$(echo $release_info | jq -r ".status")
echo "No releases found or request failed" if [ "$status_code" != "null" ]; then
echo "No releases found or request failed, status code: $status_code"
echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV echo "DEB_DOWNLOADED=false" >> $GITHUB_ENV
exit 0 exit 0
fi 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 '_') 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) control_version=$(grep '^Version:' control | cut -d ' ' -f 2)
if [ "$release_version" = "$control_version" ]; then if [ "$release_version" = "$control_version" ]; then
@ -99,7 +102,9 @@ jobs:
- name: Download and Unzip Orion - name: Download and Unzip Orion
run: | 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 unzip Orion.zip
- name: Download Discord IPA - name: Download Discord IPA
@ -112,7 +117,7 @@ jobs:
- name: Download IPA patcher - name: Download IPA patcher
working-directory: patcher working-directory: patcher
run: | 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 chmod +x patcher
- name: Download IPA icons - name: Download IPA icons
@ -230,3 +235,4 @@ jobs:
default_author: github_actions default_author: github_actions
message: "chore: update app-repo.json" message: "chore: update app-repo.json"
add: app-repo.json add: app-repo.json