|
| 1 | +name: Build SCInsta (Rootless + Rootful) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths: |
| 7 | + - '.github/workflows/build-scinsta.yml' |
| 8 | + schedule: |
| 9 | + - cron: "0 12 * * 0" # weekly check every Sunday at noon UTC |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + commit_id: |
| 13 | + description: "(Optional) SCInsta commit ID to build at" |
| 14 | + default: "" |
| 15 | + required: false |
| 16 | + type: string |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + cancel-in-progress: true |
| 21 | + |
| 22 | +jobs: |
| 23 | + build: |
| 24 | + name: Build SCInsta (${{ matrix.mode }}) |
| 25 | + runs-on: macos-14 |
| 26 | + permissions: |
| 27 | + contents: write |
| 28 | + |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + mode: [rootless, rootfull] |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout this repo |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Checkout SoCuul/SCInsta |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + repository: SoCuul/SCInsta |
| 41 | + ref: ${{ github.event.inputs.commit_id || 'main' }} |
| 42 | + path: main |
| 43 | + submodules: true |
| 44 | + |
| 45 | + - name: Install Dependencies |
| 46 | + run: brew install make dpkg ldid |
| 47 | + |
| 48 | + - name: Add GNU Make to PATH |
| 49 | + run: | |
| 50 | + echo "$(brew --prefix make)/libexec/gnubin" >> "$GITHUB_PATH" |
| 51 | +
|
| 52 | + - name: Setup Theos |
| 53 | + uses: Randomblock1/theos-action@v1 |
| 54 | + |
| 55 | + - name: Get SCInsta Version |
| 56 | + run: | |
| 57 | + SCINSTA_VERSION=$(awk '/Version:/ {print $2}' main/control) |
| 58 | + echo "SCINSTA_VERSION=${SCINSTA_VERSION}" >> "$GITHUB_ENV" |
| 59 | + echo "$SCINSTA_VERSION" |
| 60 | +
|
| 61 | + - name: Build Package (${{ matrix.mode }}) |
| 62 | + run: | |
| 63 | + cd ${{ github.workspace }}/main |
| 64 | + if [ "${{ matrix.mode }}" = "rootfull" ]; then |
| 65 | + sed -i '' '/^THEOS_PACKAGE_SCHEME/d' Makefile |
| 66 | + unset THEOS_PACKAGE_SCHEME |
| 67 | + make package FINALPACKAGE=1 |
| 68 | + else |
| 69 | + export THEOS_PACKAGE_SCHEME=rootless |
| 70 | + make package FINALPACKAGE=1 |
| 71 | + fi |
| 72 | + env: |
| 73 | + THEOS_PACKAGE_SCHEME: ${{ matrix.mode == 'rootfull' && '' || 'rootless' }} |
| 74 | + |
| 75 | + - name: Get package filename |
| 76 | + id: package_name |
| 77 | + run: | |
| 78 | + echo "package=$(ls -t main/packages/*.deb | head -n1)" >> "$GITHUB_OUTPUT" |
| 79 | +
|
| 80 | + - name: Upload .deb artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: SCInsta-${{ matrix.mode }}_${{ env.SCINSTA_VERSION }} |
| 84 | + path: ${{ steps.package_name.outputs.package }} |
| 85 | + if-no-files-found: error |
| 86 | + |
| 87 | + - name: Upload deb for commit job |
| 88 | + uses: actions/upload-artifact@v4 |
| 89 | + with: |
| 90 | + name: scinsta-deb-${{ matrix.mode }} |
| 91 | + path: ${{ steps.package_name.outputs.package }} |
| 92 | + |
| 93 | + commit-debs: |
| 94 | + name: Commit .debs to repo |
| 95 | + needs: build |
| 96 | + runs-on: ubuntu-latest |
| 97 | + permissions: |
| 98 | + contents: write |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: Checkout repo |
| 102 | + uses: actions/checkout@v4 |
| 103 | + with: |
| 104 | + fetch-depth: 0 |
| 105 | + |
| 106 | + - name: Download rootless deb |
| 107 | + uses: actions/download-artifact@v4 |
| 108 | + with: |
| 109 | + name: scinsta-deb-rootless |
| 110 | + path: debs/ |
| 111 | + |
| 112 | + - name: Download rootfull deb |
| 113 | + uses: actions/download-artifact@v4 |
| 114 | + with: |
| 115 | + name: scinsta-deb-rootfull |
| 116 | + path: debs/ |
| 117 | + |
| 118 | + - name: Commit new .debs |
| 119 | + run: | |
| 120 | + git config user.name "GitHub Actions" |
| 121 | + git config user.email "actions@github.com" |
| 122 | + git add debs/*.deb |
| 123 | + git commit -m "chore: add SCInsta rootless + rootfull debs [ci skip]" || echo "No changes to commit" |
| 124 | + git pull --rebase |
| 125 | + git push |
| 126 | + env: |
| 127 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments