forked from wjz304/OpenCore_Patch_Build
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (109 loc) · 4.27 KB
/
Build.yml
File metadata and controls
128 lines (109 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#
# 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-latest
env:
JOB_TYPE: BUILD
steps:
- uses: actions/checkout@main
- 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 https://github.com/acidanthera/OpenCorePkg.git OpenCore_Mod
cd ./OpenCore_Mod
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
if git apply --check $GITHUB_WORKSPACE/mod.patch; then
git apply $GITHUB_WORKSPACE/mod.patch
curhead=${currentgit}
curdate=$(date +"%Y-%m-%d")
curuser=304403268
sed -i'.bak' "s/OpenCore-Mod-XXXXXXXX-XXXX-XX-XX-XXXXXXXXXX/OpenCore-Mod-${curhead}-${curdate}-${curuser}/" ./Library/OcMainLib/OpenCoreMisc.c
echo "isNew=true" >> $GITHUB_ENV
echo "currenttag=${currenttag}" >> $GITHUB_ENV
echo "gitrevhead=${currentgit}" >> $GITHUB_ENV
[ "${latestgit}" == "null" ] && latestgit=.
echo 'gitupgrade<<EOF' >> $GITHUB_ENV
git log ${latestgit}..${currentgit} --oneline >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
else
echo "error"
echo "isNew=false" >> $GITHUB_ENV
fi
fi
- name: build Duet
if: env.isNew == 'true'
run: cd OpenCore_Mod && ./build_duet.tool
- name: build OC
if: env.isNew == 'true'
run: cd OpenCore_Mod && ./build_oc.tool
- name: Upload to Artifacts
if: env.isNew == 'true'
uses: actions/upload-artifact@v3
with:
name: macOS XCODE5 Artifacts
path: OpenCore_Mod/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 OpenCorePkg](https://github.com/acidanthera/OpenCorePkg/commits/master)
files: OpenCore_Mod/Binaries/*.zip