-
Notifications
You must be signed in to change notification settings - Fork 12
123 lines (106 loc) · 4.42 KB
/
Build.yml
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
#
# 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:
- name: Checkout
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: Install Linux Toolchain
run: |
brew tap FiloSottile/homebrew-musl-cross
brew install musl-cross
brew install openssl mingw-w64 nasm jq
- name: CI Bootstrap
run: |
git config --global http.postBuffer 1048576000
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 -LfsS 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_en.tool
cd OpenCore_NO_ACPI
./build_duet_en.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_en.tool
cd OpenCore_NO_ACPI
./build_oc_en.tool
- name: Upload to Artifacts
if: env.isNew == 'true'
uses: actions/upload-artifact@v4
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@v2
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