Skip to content

復原SDK

復原SDK #89

Workflow file for this run

name: Xcode - Build
on:
push:
pull_request:
workflow_dispatch:
inputs:
release__nightly:
description: Create a nightly release
type: boolean
required: false
default: true
jobs:
build:
name: Build using xcodebuild command
runs-on: macos-latest
env:
scheme: OpenParsec
archive_path: archive
outputs:
scheme: ${{ steps.scheme.outputs.scheme }}
archive_path: ${{ env.archive_path }}
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "26.1"
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set Scheme
id: scheme
run: |
if [ $scheme = default ]
then
scheme_list=$(xcodebuild -list -json | tr -d "\n")
scheme=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo Using default scheme: $scheme
else
echo Using configured scheme: $scheme
fi
echo "scheme=$scheme" >> $GITHUB_OUTPUT
- name: Set filetype_parameter
id: filetype_parameter
run: |
filetype_parameter=`ls -A | grep -i \\.xcworkspace\$ && echo workspace || echo project`
echo "filetype_parameter=$filetype_parameter" >> $GITHUB_OUTPUT
- name: Set file_to_build
id: file_to_build
run: |
file_to_build=`ls -A | grep -i \\.xcworkspace\$ || ls -A | grep -i \\.xcodeproj\$`
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
echo "file_to_build=$file_to_build" >> $GITHUB_OUTPUT
- name: Archive
env:
scheme: ${{ steps.scheme.outputs.scheme }}
filetype_parameter: ${{ steps.filetype_parameter.outputs.filetype_parameter }}
file_to_build: ${{ steps.file_to_build.outputs.file_to_build }}
run: xcodebuild archive -archivePath "$archive_path" -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -sdk iphoneos -arch arm64 -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]}
- name: Tar Build Artifact
run: tar -cvf "$archive_path.xcarchive.tar" "$archive_path.xcarchive"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.archive_path }}.xcarchive.tar
path: ${{ env.archive_path }}.xcarchive.tar
package:
name: Create fake-signed ipa
runs-on: ubuntu-latest
needs: [build]
env:
scheme: ${{ needs.build.outputs.scheme }}
archive_path: ${{ needs.build.outputs.archive_path }}
outputs:
artifact: ${{ env.scheme }}.ipa
build_time: ${{ steps.timestamp.outputs.build_time }}
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.archive_path }}.xcarchive.tar
- name: Extract Build Artifact
run: tar -xf "$archive_path.xcarchive.tar"
- name: Install ldid
run: |
if [ `uname -s` = "Linux" ]; then
curl -sSL -o /usr/local/bin/ldid "${{ github.server_url }}/ProcursusTeam/ldid/releases/latest/download/ldid_linux_`uname -m`"
chmod +x /usr/local/bin/ldid
elif [ `uname -s` = "Darwin" ]; then
brew install ldid
else
exit 1
fi
- name: Fakesign
run: |
find "$archive_path.xcarchive/Products/Applications/$scheme.app" -type d -path '*/Frameworks/*.framework' -exec ldid -S \{\} \;
ldid -S "$archive_path.xcarchive/Products/Applications/$scheme.app"
- name: Create IPA
run: |
mv "$archive_path.xcarchive/Products/Applications" Payload
zip -r "$scheme.ipa" "Payload" -x "._*" -x ".DS_Store" -x "__MACOSX"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.scheme }}.ipa
path: ${{ env.scheme }}.ipa
- name: Set timestamp
id: timestamp
run: |
# 設定時區為台北
export TZ="Asia/Taipei"
# 取得當前日期與時間
YEAR=$(date +%Y)
MONTH=$(date +%-m)
DAY=$(date +%-d)
HOUR=$(date +%-H)
MINUTE=$(date +%M)
# 判斷上午/下午
if [ $HOUR -ge 12 ]; then
AP="下午"
HOUR=$((HOUR-12))
[ $HOUR -eq 0 ] && HOUR=12
else
AP="上午"
[ $HOUR -eq 0 ] && HOUR=12
fi
# 星期轉換
WEEKDAY_NUM=$(date +%u) # 1 = Monday ... 7 = Sunday
case $WEEKDAY_NUM in
1) WEEKDAY="週一";;
2) WEEKDAY="週二";;
3) WEEKDAY="週三";;
4) WEEKDAY="週四";;
5) WEEKDAY="週五";;
6) WEEKDAY="週六";;
7) WEEKDAY="週日";;
esac
# 拼接最終字串
BUILD_TIME="${YEAR}/${MONTH}/${DAY} ${AP}${HOUR}:${MINUTE} ${WEEKDAY}"
echo "build_time=$BUILD_TIME" >> $GITHUB_OUTPUT
release__nightly:
name: Nightly Release
permissions:
contents: write
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.release__nightly == 'true') ||
(github.event_name == 'push' && (github.ref == format('refs/heads/{0}', github.repository.default_branch) || github.ref == 'refs/heads/patch-1')) }}
runs-on: ubuntu-latest
needs: [package]
concurrency:
group: release__nightly
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download a Build Artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.package.outputs.artifact }}
- name: Update AltStore source
id: update_source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NIGHTLY_LINK: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}
commit_sha: ${{ env.COMMIT_SHA }}
commit_msg: ${{ env.COMMIT_MSG }}
run: |
python update_json.py
- name: Nightly Release
uses: andelf/nightly-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: "Nightly Release @ ${{ needs.package.outputs.build_time }}"
body: |
This is a nightly release created at ${{ needs.package.outputs.build_time }}.
[Workflow link](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}).
files: |
${{ needs.package.outputs.artifact }}
altstore.json