Update package.yml #4
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 install packages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - dev | |
| paths: | |
| - '.github/workflows/package.yml' | |
| - 'src/install/admin/**' | |
| - 'src/install/setup/**' | |
| - 'assets/install/setup/**' | |
| jobs: | |
| package: | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build install packages | |
| shell: bash | |
| run: | | |
| set -Eeuo pipefail | |
| work="$RUNNER_TEMP/macos-packages" | |
| rm -rf "$work" | |
| mkdir -p \ | |
| "$work/admin/scripts" \ | |
| "$work/setup/scripts" \ | |
| assets/install/package | |
| python3 src/install/admin/create.py \ | |
| "$work/admin/scripts" \ | |
| admin \ | |
| admin \ | |
| Y | |
| cp src/install/admin/postinstall "$work/admin/scripts/postinstall" | |
| chmod 0755 "$work/admin/scripts/postinstall" "$work/admin/scripts/config" | |
| chmod 0600 "$work/admin/scripts/user.plist" | |
| [ ! -f "$work/admin/scripts/kcpassword" ] || chmod 0600 "$work/admin/scripts/kcpassword" | |
| python3 src/install/admin/validate.py \ | |
| "$work/admin/scripts/user.plist" \ | |
| admin | |
| pkgbuild \ | |
| --nopayload \ | |
| --identifier com.macos.install.admin \ | |
| --version 1.0 \ | |
| --scripts "$work/admin/scripts" \ | |
| "$work/admin/component.pkg" | |
| productbuild \ | |
| --package "$work/admin/component.pkg" \ | |
| --identifier com.macos.install.admin \ | |
| --version 1.0 \ | |
| assets/install/package/admin.pkg | |
| cp src/install/setup/postinstall "$work/setup/scripts/postinstall" | |
| cp assets/install/setup/com.apple.SetupAssistant.plist \ | |
| "$work/setup/scripts/com.apple.SetupAssistant.plist" | |
| chmod 0755 "$work/setup/scripts/postinstall" | |
| chmod 0644 "$work/setup/scripts/com.apple.SetupAssistant.plist" | |
| bash -n "$work/setup/scripts/postinstall" | |
| pkgbuild \ | |
| --nopayload \ | |
| --identifier com.macos.install.skipsetup \ | |
| --version 1.0 \ | |
| --scripts "$work/setup/scripts" \ | |
| "$work/setup/component.pkg" | |
| productbuild \ | |
| --package "$work/setup/component.pkg" \ | |
| --identifier com.macos.install.skipsetup \ | |
| --version 1.0 \ | |
| assets/install/package/skipsetup.pkg | |
| - name: Verify install packages | |
| shell: bash | |
| run: | | |
| set -Eeuo pipefail | |
| for package in admin skipsetup; do | |
| file="assets/install/package/$package.pkg" | |
| [ -s "$file" ] | |
| listing=$(xar -tf "$file") | |
| grep -Fxq Distribution <<< "$listing" | |
| grep -Fxq component.pkg/PackageInfo <<< "$listing" | |
| grep -Fxq component.pkg/Scripts <<< "$listing" | |
| dir="$RUNNER_TEMP/verify-$package" | |
| rm -rf "$dir" | |
| mkdir -p "$dir" | |
| (cd "$dir" && xar -xf "$GITHUB_WORKSPACE/$file") | |
| gzip -dc "$dir/component.pkg/Scripts" | cpio -it 2>/dev/null | grep -Fxq postinstall | |
| done | |
| shasum -a 256 \ | |
| assets/install/package/admin.pkg \ | |
| assets/install/package/skipsetup.pkg | |
| - name: Upload install packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-install-packages-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: | | |
| assets/install/package/admin.pkg | |
| assets/install/package/skipsetup.pkg |