Add Commit Data to all builds

This commit is contained in:
Mykola Grymalyuk
2022-01-19 11:18:43 -07:00
parent c78506501f
commit 07b9a1a2c6
6 changed files with 52 additions and 43 deletions

View File

@@ -10,11 +10,16 @@ jobs:
build:
name: Build Offline TUI
runs-on: x86_64_mojave
env:
commitmsg: ${{ github.event.head_commit.message }}
branch: ${{ github.event.ref }}
commiturl: ${{ github.event.head_commit.url }}
commitdate: ${{ github.event.head_commit.timestamp }}
steps:
- uses: actions/checkout@v2
- run: python3 create_offline_build.py
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: python3 ./payloads/binary.py
- run: python3 ./payloads/binary.py $commitmsg $branch $commiturl $commitdate
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app

View File

@@ -10,11 +10,16 @@ jobs:
build:
name: Build wxPython Offline
runs-on: x86_64_mojave
env:
commitmsg: ${{ github.event.head_commit.message }}
branch: ${{ github.event.ref }}
commiturl: ${{ github.event.head_commit.url }}
commitdate: ${{ github.event.head_commit.timestamp }}
steps:
- uses: actions/checkout@v2
- run: python3 create_offline_build.py
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
- run: python3 ./payloads/binary.py
- run: python3 ./payloads/binary.py $commitmsg $branch $commiturl $commitdate
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
- run: ./../sign-wxpython.sh

View File

@@ -12,14 +12,13 @@ jobs:
runs-on: x86_64_mojave
env:
commitmsg: ${{ github.event.head_commit.message }}
commitid: ${{ github.event.head_commit.id }}
branch: ${{ github.event.ref }}
commiturl: ${{ github.event.head_commit.url }}
commitdate: ${{ github.event.head_commit.timestamp }}
steps:
- uses: actions/checkout@v2
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
- run: python3 ./payloads/binary.py $commitmsg $commitid $branch $commiturl $commitdate
- run: python3 ./payloads/binary.py $commitmsg $branch $commiturl $commitdate
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
- run: ./../sign-wxpython.sh

View File

@@ -10,10 +10,15 @@ jobs:
build:
name: Build TUI
runs-on: x86_64_mojave
env:
commitmsg: ${{ github.event.head_commit.message }}
branch: ${{ github.event.ref }}
commiturl: ${{ github.event.head_commit.url }}
commitdate: ${{ github.event.head_commit.timestamp }}
steps:
- uses: actions/checkout@v2
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: python3 ./payloads/binary.py
- run: python3 ./payloads/binary.py $commitmsg $branch $commiturl $commitdate
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app

View File

@@ -1,6 +1,6 @@
# -*- mode: python ; coding: utf-8 -*-
import sys, os, time
import sys, os, time, subprocess
sys.path.append(os.path.abspath(os.getcwd()))
from resources import constants
block_cipher = None
@@ -51,4 +51,5 @@ app = BUNDLE(exe,
"NSRequiresAquaSystemAppearance": False,
"NSHighResolutionCapable": True,
"Build Date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
"BuildMachineOSBuild": subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode().strip(),
})

View File

@@ -1,16 +1,6 @@
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
#
# By default Pyinstaller will create binaries supporting 10.13+
# However this limitation is entirely arbitrary for our libraries
# and instead we're able to support 10.10 without issues.
#
# To verify set version:
# otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
#
# cmd LC_VERSION_MIN_MACOSX
# cmdsize 16
# version 10.13
# sdk 10.9
# Handle Misc patching for binaries during commit
# This includes Load Command Patching as well as Info.plist patching
# Copyright (C) 2022 - Mykola Grymalyuk
import sys
import plistlib
from pathlib import Path
@@ -19,8 +9,20 @@ def main():
patch_load_command()
patch_info_plist()
def patch_load_command():
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
#
# By default Pyinstaller will create binaries supporting 10.13+
# However this limitation is entirely arbitrary for our libraries
# and instead we're able to support 10.10 without issues.
#
# To verify set version:
# otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
#
# cmd LC_VERSION_MIN_MACOSX
# cmdsize 16
# version 10.13
# sdk 10.9
print("- Patching LC_VERSION_MIN_MACOSX")
path = './dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher'
find = b'\x00\x0D\x0A\x00' # 10.13 (0xA0D)
@@ -32,30 +34,22 @@ def patch_load_command():
f.write(data)
def patch_info_plist():
# Add Commit Data to Info.plist
print("- Updating Info.plist")
# Github Actions will supply us with the following environment variables:
# - Commit Message
# - Commit ID
# - Branch
# - Commit URL
# - Commit Date
argsv = sys.argv
argsv.pop(0)
plist_path = './dist/OpenCore-Patcher.app/Contents/Info.plist'
plist = plistlib.load(Path(plist_path).open("rb"))
print("- Loaded Plist")
# Add Github Dictonary
print("- Adding Github Dictionary")
plist["Github"] = {
"Commit Message": argsv[0],
"Commit ID": argsv[1],
"Branch": argsv[2],
"Commit URL": argsv[3],
"Commit Date": argsv[4],
}
print("- Writing Plist")
plistlib.dump(plist, Path(plist_path).open("wb"), sort_keys=True)
if argsv:
plist_path = './dist/OpenCore-Patcher.app/Contents/Info.plist'
plist = plistlib.load(Path(plist_path).open("rb"))
print("- Adding Github Dictionary")
plist["Github"] = {
"Commit Message": argsv[0],
"Branch": argsv[1],
"Commit URL": argsv[2],
"Commit Date": argsv[3],
}
print("- Writing Plist")
plistlib.dump(plist, Path(plist_path).open("wb"), sort_keys=True)
else:
print("- No commit data supplied, skipping")
main()