From 3ebfff2d41b8baa6b122e4141a90f4b6c677cc11 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Mon, 26 Aug 2024 11:53:59 -0600 Subject: [PATCH] CI: Publish automatic patcher --- .github/workflows/patch.yml | 74 ++++++++++++++++++++++++++++++++ metal_libraries/__init__.py | 2 +- metal_libraries/utils/ci_info.py | 2 +- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/patch.yml diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml new file mode 100644 index 0000000..78ded2f --- /dev/null +++ b/.github/workflows/patch.yml @@ -0,0 +1,74 @@ +name: CI - Patch latest Sequoia metallib's + +on: + schedule: + - cron: "0 */2 * * *" + push: + branches: + - main + +jobs: + build: + name: CI - Patch latest Sequoia metallib's + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies + run: python3 -m pip install -r requirements.txt + + - name: Download latest Sequoia IPSW + run: echo "IPSW_FILE=$(python3 metallib.py --download --continuous-integration)" >> $GITHUB_OUTPUT + id: download + + - name: Extract system volume + if: steps.download.outputs.IPSW_FILE != '' + run: echo "DMG_FILE=$(python3 metallib.py --extract ${{ steps.download.outputs.IPSW_FILE }})" >> $GITHUB_OUTPUT + id: extract + + - name: Fetch metal libraries + if: steps.extract.outputs.DMG_FILE != '' + run: echo "BACKUP_FOLDER=$(python3 metallib.py --fetch ${{ steps.extract.outputs.DMG_FILE }})" >> $GITHUB_OUTPUT + id: fetch + + - name: Patch metal libraries + if: steps.fetch.outputs.BACKUP_FOLDER != '' + run: python3 metallib.py --patch ${{ steps.fetch.outputs.BACKUP_FOLDER }} + + - name: Build sys_patch_dict.py + if: steps.fetch.outputs.BACKUP_FOLDER != '' + run: python3 metallib.py --build-sys-patch ${{ steps.fetch.outputs.BACKUP_FOLDER }} --continuous-integration + + - name: Build Package + if: steps.fetch.outputs.BACKUP_FOLDER != '' + run: python3 metallib.py --build-package ${{ steps.fetch.outputs.BACKUP_FOLDER }} + + - name: Upload metal libraries to Artifactions + if: steps.fetch.outputs.BACKUP_FOLDER != '' + uses: actions/upload-artifact@v3 + with: + name: MetallibSupportPkg.pkg + path: ./MetallibSupportPkg-*.pkg + + - name: Upload sys_patch_dict.py to Artifactions + if: steps.fetch.outputs.BACKUP_FOLDER != '' + uses: actions/upload-artifact@v3 + with: + name: sys_patch_dict.py + path: sys_patch_dict.py + + - name: Create GitHub release + if: steps.fetch.outputs.BACKUP_FOLDER != '' + uses: softprops/action-gh-release@v1 + with: + files: | + MetallibSupportPkg-*.pkg + sys_patch_dict.py + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ steps.fetch.outputs.BACKUP_FOLDER }} \ No newline at end of file diff --git a/metal_libraries/__init__.py b/metal_libraries/__init__.py index b0033de..cbf0685 100644 --- a/metal_libraries/__init__.py +++ b/metal_libraries/__init__.py @@ -5,7 +5,7 @@ __title__ = "metal_libraries" __version__ = "1.0.0" __author__ = "Dortania" -__url__ = "https://www.github.com/khronokernel/MetallibSupportPkg" +__url__ = "https://www.github.com/dortania/MetallibSupportPkg" from .cli import main diff --git a/metal_libraries/utils/ci_info.py b/metal_libraries/utils/ci_info.py index 2c7c39a..3c0ee35 100644 --- a/metal_libraries/utils/ci_info.py +++ b/metal_libraries/utils/ci_info.py @@ -10,7 +10,7 @@ class CIInfo: def __init__(self) -> None: - self._url = "https://api.github.com/repos/khronokernel/MetallibSupportPkg/releases" + self._url = "https://api.github.com/repos/dortania/MetallibSupportPkg/releases" def published_releases(self) -> list[str]: