Build OpenCore-Mod #1880
This file contains 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
# | |
# Copyright (C) 2022 Ing <https://github.com/wjz304> | |
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
name: Build OpenCore-Mod | |
on: | |
push: | |
schedule: | |
- cron: '20 */6 * * *' | |
workflow_dispatch: | |
env: | |
PROJECT_TYPE: UEFI | |
FORCE_INSTALL: 1 | |
HAS_OPENSSL_BUILD: 1 | |
HAS_OPENSSL_W32BUILD: 0 | |
WERROR: 1 | |
jobs: | |
build-macos: | |
name: macOS XCODE5 | |
runs-on: macos-12 | |
env: | |
JOB_TYPE: BUILD | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Set up Python 3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Initialization environment | |
run : | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
sudo systemsetup -settimezone "Asia/Shanghai" | |
- name: Add Linux Toolchain | |
run: brew tap FiloSottile/homebrew-musl-cross | |
- name: Install Linux Toolchain | |
run: brew install musl-cross | |
env: | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
- name: Install Dependencies | |
run: brew install openssl mingw-w64 nasm jq | |
env: | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
- name: CI Bootstrap | |
run: | | |
git clone --depth=100 https://gitee.com/btwise/OpenCore_NO_ACPI.git OpenCore_NO_ACPI | |
cd ./OpenCore_NO_ACPI | |
# 容错 | |
[[ $(head -n 1 Library/OcConfigurationLib/CheckSchema.py) != \#\!* ]] && sed -i.bak '1d' Library/OcConfigurationLib/CheckSchema.py | |
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 | |
# jq parses json, # token https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps | |
latesttag=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -sL https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest | jq -r .tag_name) | |
latestgit=${latesttag#*_} | |
currenttag=$(grep OPEN_CORE_VERSION Include/Acidanthera/Library/OcMainLib.h | sed 's/.*"\(.*\)".*/\1/' | grep -E '^[0-9.]+$')_$(git rev-parse --short HEAD) | |
currentgit=${currenttag#*_} | |
echo latesttag: $latesttag | |
echo latestgit: $latestgit | |
echo currenttag: $currenttag | |
echo currentgit: $currentgit | |
if [ "${latesttag}" == "${currenttag}" ]; then | |
echo "isNew=false" >> $GITHUB_ENV | |
else | |
echo "isNew=true" >> $GITHUB_ENV | |
echo "currenttag=${currenttag}" >> $GITHUB_ENV | |
echo "gitrevhead=${currentgit}" >> $GITHUB_ENV | |
echo 'gitupgrade<<EOF' >> $GITHUB_ENV | |
[ "${latestgit}" == "null" ] && latestgit=. | |
git log ${latestgit}..${currentgit} --oneline >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
fi | |
echo ${{ env.isNew }} | |
echo ${{ env.currenttag }} | |
echo ${{ env.gitrevhead }} | |
echo ${{ env.gitupgrade }} | |
- name: build Duet | |
if: env.isNew == 'true' | |
run: | | |
sed -i.bak "s|https://gitee.com/btwise/ocbuild/raw/master/efibuild.sh|https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh|" OpenCore_NO_ACPI/build_duet.tool | |
cd OpenCore_NO_ACPI | |
./build_duet.tool | |
- name: build OC | |
if: env.isNew == 'true' | |
run: | | |
sed -i.bak "s|https://gitcode.net/btwise/ocbuild/-/raw/master/efibuild.sh|https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh|" OpenCore_NO_ACPI/build_oc.tool | |
cd OpenCore_NO_ACPI | |
./build_oc.tool | |
- name: Upload to Artifacts | |
if: env.isNew == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macOS XCODE5 Artifacts | |
path: OpenCore_NO_ACPI/Binaries/*.zip | |
- name: Commit and Push | |
if: env.isNew == 'true' | |
run: | | |
echo ${{ env.currenttag }} > latest | |
git add latest | |
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)" | |
git push -f | |
- name: Upload to Release | |
if: env.isNew == 'true' | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.currenttag }} | |
body: | | |
Changes: | |
${{ env.gitupgrade }} | |
[View on gitee](https://gitee.com/btwise/OpenCore_NO_ACPI/commits/${{ env.gitrevhead }}) | |
files: OpenCore_NO_ACPI/Binaries/*.zip |