Build SCInsta (Rootless + Rootful) #13
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: Build SCInsta (Rootless + Rootful) | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - '.github/workflows/build-scinsta.yml' | |
| schedule: | |
| - cron: "0 12 * * 0" # weekly check every Sunday at noon UTC | |
| workflow_dispatch: | |
| inputs: | |
| commit_id: | |
| description: "(Optional) SCInsta commit ID to build at" | |
| default: "" | |
| required: false | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build SCInsta (${{ matrix.mode }}) | |
| runs-on: macos-14 | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| mode: [rootless, rootfull] | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| - name: Checkout SoCuul/SCInsta | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: SoCuul/SCInsta | |
| ref: ${{ github.event.inputs.commit_id || 'main' }} | |
| path: main | |
| submodules: true | |
| - name: Install Dependencies | |
| run: brew install make dpkg ldid | |
| - name: Add GNU Make to PATH | |
| run: | | |
| echo "$(brew --prefix make)/libexec/gnubin" >> "$GITHUB_PATH" | |
| - name: Download Theos | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: theos/theos | |
| ref: master | |
| path: theos | |
| submodules: recursive | |
| - name: iOS SDK Caching | |
| id: SDK | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: iOS-16.5-SDK | |
| with: | |
| path: ${{ github.workspace }}/theos/sdks/ | |
| key: ${{ env.cache-name }} | |
| restore-keys: ${{ env.cache-name }} | |
| - name: Download iOS SDK | |
| if: steps.SDK.outputs.cache-hit != 'true' | |
| run: | | |
| git clone -n --depth=1 --filter=tree:0 https://github.com/theos/sdks/ | |
| cd sdks | |
| git sparse-checkout set --no-cone iPhoneOS16.5.sdk | |
| git checkout | |
| mv iPhoneOS16.5.sdk "$THEOS/sdks/" | |
| env: | |
| THEOS: ${{ github.workspace }}/theos | |
| - name: Get SCInsta Version | |
| run: | | |
| SCINSTA_VERSION=$(awk '/Version:/ {print $2}' main/control) | |
| echo "SCINSTA_VERSION=${SCINSTA_VERSION}" >> "$GITHUB_ENV" | |
| echo "$SCINSTA_VERSION" | |
| - name: Update SDK version in Makefile | |
| run: | | |
| cd ${{ github.workspace }}/main | |
| sed -i '' 's/16\.2/16.5/g' Makefile | |
| - name: Build Package (${{ matrix.mode }}) | |
| run: | | |
| cd ${{ github.workspace }}/main | |
| if [ "${{ matrix.mode }}" = "rootfull" ]; then | |
| sed -i '' '/^THEOS_PACKAGE_SCHEME/d' Makefile | |
| unset THEOS_PACKAGE_SCHEME | |
| make package FINALPACKAGE=1 | |
| else | |
| export THEOS_PACKAGE_SCHEME=rootless | |
| make package FINALPACKAGE=1 | |
| fi | |
| env: | |
| THEOS: ${{ github.workspace }}/theos | |
| THEOS_PACKAGE_SCHEME: ${{ matrix.mode == 'rootfull' && '' || 'rootless' }} | |
| - name: Get package filename | |
| id: package_name | |
| run: | | |
| echo "package=$(ls -t main/packages/*.deb | head -n1)" >> "$GITHUB_OUTPUT" | |
| - name: Upload .deb artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SCInsta-${{ matrix.mode }}_${{ env.SCINSTA_VERSION }} | |
| path: ${{ steps.package_name.outputs.package }} | |
| if-no-files-found: error | |
| - name: Upload deb for commit job | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scinsta-deb-${{ matrix.mode }} | |
| path: ${{ steps.package_name.outputs.package }} | |
| commit-debs: | |
| name: Commit .debs to repo | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download rootless deb | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scinsta-deb-rootless | |
| path: debs/ | |
| - name: Download rootfull deb | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: scinsta-deb-rootfull | |
| path: debs/ | |
| - name: Commit new .debs | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| git add debs/*.deb | |
| git commit -m "chore: add SCInsta rootless + rootfull debs [ci skip]" || echo "No changes to commit" | |
| git pull --rebase | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |