fix #628 #300
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Xcode - Build | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| release__nightly: | |
| description: Create a nightly release | |
| type: boolean | |
| required: false | |
| jobs: | |
| build: | |
| name: Build using xcodebuild command | |
| runs-on: macos-latest | |
| env: | |
| scheme: LiveContainer | |
| archive_path: archive | |
| outputs: | |
| scheme: ${{ steps.scheme.outputs.scheme }} | |
| archive_path: ${{ env.archive_path }} | |
| artifact: ${{ env.scheme }}.ipa | |
| steps: | |
| - uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '16.2' | |
| - 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 | 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 | |
| - 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 | |
| release__nightly: | |
| name: Nightly Release | |
| permissions: | |
| contents: write | |
| if: inputs.release__nightly || github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| concurrency: | |
| group: release__nightly | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Download a Build Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.build.outputs.artifact }} | |
| - name: Update AltStore source | |
| id: update_source | |
| run: | | |
| NIGHTLY_LINK="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}" python update_json.py | |
| - name: Nightly Release | |
| uses: andelf/nightly-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| body: | | |
| This is a nightly release [created automatically with GitHub Actions workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}). | |
| files: | | |
| ${{ needs.build.outputs.artifact }} | |
| apps_nightly.json |