forked from DreamOneX/PhoenixBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (232 loc) · 9.46 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Build binaries and Upload to Release
on:
push:
branches: [ main ]
paths:
- "version"
workflow_dispatch: {}
jobs:
linux-build:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v2
- name: Cache NDK
id: cache-ndk
uses: actions/cache@v3
with:
key: android-ndk-r20b-cache
path: ~/android-ndk-r20b
- name: Set up NDK
if: steps.cache-ndk.outputs.cache-hit != 'true'
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r20b
add-to-path: false
- name: Move NDK
if: steps.cache-ndk.outputs.cache-hit != 'true'
run: mv ${{ steps.setup-ndk.outputs.ndk-path }} ${HOME}/android-ndk-r20b
- name: Install compilers
run: |
sudo apt update
sudo apt install gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 gcc gcc-aarch64-linux-gnu libgl1-mesa-dev xorg-dev -y
- name: Setup theos's dependencies
run: sudo apt install fakeroot git perl zip unzip rename build-essential libtinfo5 libplist-utils brotli
- name: Cache theos and toolchain
id: cache-theos
uses: actions/cache@v3
with:
key: theos-with-ios-and-macos-sdk-plus-ios-toolchain-cache
path: ~/theos
- name: Clone theos
if: steps.cache-theos.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
submodules: 'recursive'
repository: 'theos/theos'
path: 'theos'
- name: Setup theos
if: steps.cache-theos.outputs.cache-hit != 'true'
run: |
mv $GITHUB_WORKSPACE/theos ~/theos
export THEOS=~/theos
echo "export THEOS=~/theos" >> ~/.profile
curl -LO https://github.com/sbingner/llvm-project/releases/latest/download/linux-ios-arm64e-clang-toolchain.tar.lzma
TMP=$(mktemp -d)
tar -xf linux-ios-arm64e-clang-toolchain.tar.lzma -C $TMP
mkdir -p $THEOS/toolchain/linux/iphone
mv $TMP/ios-arm64e-clang-toolchain/* $THEOS/toolchain/linux/iphone/
rm -r linux-ios-arm64e-clang-toolchain.tar.lzma $TMP
curl -LO https://github.com/theos/sdks/archive/master.zip
TMP=$(mktemp -d)
unzip -q master.zip -d $TMP
mv $TMP/sdks-master/*.sdk $THEOS/sdks
rm -r master.zip $TMP
- name: Download macOS SDK
if: steps.cache-theos.outputs.cache-hit != 'true'
run: |
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xJf MacOSX11.0.sdk.tar.xz
rm MacOSX11.0.sdk.tar.xz
mv MacOSX11.0.sdk ~/theos/sdks/MacOSX11.0.sdk
#- name: Clone macOS SDK
# uses: actions/checkout@v2
# with:
# repository: 'phracker/MacOSX-SDKs'
# path: 'macOS-sdks'
#- name: Configure macOS SDK
# run: |
# mv $GITHUB_WORKSPACE/macOS-sdks/MacOSX11.0.sdk ~/theos/sdks/MacOSX11.0.sdk
# rm -rf $GITHUB_WORKSPACE/macOS-sdks
# Debian/Ubuntu provided LLVM only support native targets, using Homebrew prebuilt for all targets
- name: Setup LLVM dependencies
run: |
sudo apt install libedit2 libxml2 libncursesw6 binutils elfutils
wget -q http://ftp.debian.org/debian/pool/main/libf/libffi/libffi8_3.4.4-1_amd64.deb
sudo dpkg -i libffi8_3.4.4-1_amd64.deb
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v3
with:
key: llvm-cache
path: ~/llvm
- name: Download LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/Torrekie/homebrew-core/releases/download/LLVM-14.0.6/llvm.tar.xz
tar xf llvm.tar.xz
rm llvm.tar.xz
mv llvm/14.0.6 ~/llvm
- name: Cache iSH GCC
id: cache-ish-gcc
uses: actions/cache@v3
with:
key: ish-gcc-cache
path: ~/i686-unknown-linux-musl
- name: Download iSH GCC
if: steps.cache-ish-gcc.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/Torrekie/homebrew-core/releases/download/i686-unknown-linux-musl/i686-unknown-linux-musl.tar.xz
tar xf i686-unknown-linux-musl.tar.xz
rm i686-unknown-linux-musl.tar.xz
mv i686-unknown-linux-musl ~/
- name: Cache Openwrt mt7620 SDK
id: cache-openwrt-mt7620-sdk
uses: actions/cache@v3
with:
key: openwrt-sdk-mt7620-cache
path: ~/openwrt-sdk-21.02.2-ramips-mt7620_gcc-8.4.0_musl.Linux-x86_64
- name: Download Openwrt mt7620 SDK
if: steps.cache-openwrt-mt7620-sdk.outputs.cache-hit != 'true'
run: |
wget -q https://archive.openwrt.org/releases/21.02.2/targets/ramips/mt7620/openwrt-sdk-21.02.2-ramips-mt7620_gcc-8.4.0_musl.Linux-x86_64.tar.xz
tar -xJf openwrt-sdk-21.02.2-ramips-mt7620_gcc-8.4.0_musl.Linux-x86_64.tar.xz
rm openwrt-sdk-21.02.2-ramips-mt7620_gcc-8.4.0_musl.Linux-x86_64.tar.xz
mv openwrt-sdk-21.02.2-ramips-mt7620_gcc-8.4.0_musl.Linux-x86_64 ~/
- name: Cache Openwrt ipq40xx-generic SDK
id: cache-openwrt-ipq40xx-generic-sdk
uses: actions/cache@v3
with:
key: openwrt-sdk-ipq40xx-generic-cache
path: ~/openwrt-sdk-22.03.0-rc4-ipq40xx-generic_gcc-11.2.0_musl_eabi.Linux-x86_64
- name: Download Openwrt ipq40xx-generic SDK
if: steps.cache-openwrt-ipq40xx-generic-sdk.outputs.cache-hit != 'true'
run: |
wget -q https://downloads.openwrt.org/releases/22.03.0-rc4/targets/ipq40xx/generic/openwrt-sdk-22.03.0-rc4-ipq40xx-generic_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz
tar -xJf openwrt-sdk-22.03.0-rc4-ipq40xx-generic_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz
rm openwrt-sdk-22.03.0-rc4-ipq40xx-generic_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz
mv openwrt-sdk-22.03.0-rc4-ipq40xx-generic_gcc-11.2.0_musl_eabi.Linux-x86_64 ~/
- name: Cache Openwrt mt7622 SDK
id: cache-openwrt-mt7622-sdk
uses: actions/cache@v3
with:
key: openwrt-sdk-mediatek-mt7622-cache
path: ~/openwrt-sdk-22.03.0-rc4-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64
- name: Download Openwrt mt7622 SDK
if: steps.cache-openwrt-mt7622-sdk.outputs.cache-hit != 'true'
run: |
wget -q https://downloads.openwrt.org/releases/22.03.0-rc4/targets/mediatek/mt7622/openwrt-sdk-22.03.0-rc4-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64.tar.xz
tar -xJf openwrt-sdk-22.03.0-rc4-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64.tar.xz
rm openwrt-sdk-22.03.0-rc4-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64.tar.xz
mv openwrt-sdk-22.03.0-rc4-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64 ~/
- name: Set build time
id: build_time
run: echo "build_time=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT
- name: Pre-Build & configure go-raknet
run: |
make current
make clean
chmod 0777 ~/go/pkg/mod/github.com/sandertv/go-raknet@v1.12.0/
sed -i "s/urrentProtocol byte = 11/urrentProtocol byte = 8/g" ~/go/pkg/mod/github.com/sandertv/go-raknet@v1.12.0/conn.go
- name: Build
run: |
export THEOS=~/theos
make all
- name: Package for specific platforms
run: |
export THEOS=~/theos
make package
- name: Archive binaries
run: |
mv release/*.deb build/
ls -lh build/>release.txt
mv release.txt build/release-list.txt
cp version build/version.txt
cp install.sh build/install.sh
tar -czf fb-upload.tar.gz build
- name: Provide release version
id: release_version
run: echo "release_version=$(cat build/version)" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v0.1.14
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.release_version.outputs.release_version }}
files: |
fb-upload.tar.gz
build/*
#- name: Generate index files for storage over github
# run: node index_generator.js build
#- name: Deploy to storage
# env:
# STORAGEKEY: ${{ secrets.STORAGEKEY }}
# run: |
# echo "$STORAGEKEY">~/storagekey
# chmod 0600 ~/storagekey
# git config --global user.email "24724395+LNSSPsd@users.noreply.github.com"
# git config --global user.name "LNSSPsd"
# git config --global core.sshCommand "ssh -i ~/storagekey"
# git clone git@github.com:LNSSPsd/PhoenixBuilder-storage.git
# ln PhoenixBuilder-storage/CNAME build/CNAME
# cp -r PhoenixBuilder-storage/.git build/.git
# cd build
# git add .
# git commit -m "Auto update" -a
# git push
# cd ..
#
#- name: Load Key
# env:
# FBKEY: ${{ secrets.FBKEY }}
# if: ${{ env.FBKEY != '' }}
# run: |
# echo "$FBKEY">~/fbkey
# mkdir -p ~/.ssh
# printf "StrictHostKeyChecking no\nUserKnownHostsFile /dev/null">~/.ssh/config
# chmod 0600 ~/fbkey
#
#- name: Upload binaries and publish
# env:
# FBUSER: ${{ secrets.FBUSER }}
# FBIP: ${{ secrets.FBIP }}
# if: ${{ env.FBUSER != '' && env.FBIP != '' }}
# run: |
# echo "put fb-upload.tar.gz">~/a
# sftp -P 8964 -i ~/fbkey -b ~/a $FBUSER@$FBIP
# ssh -i ~/fbkey $FBUSER@$FBIP -p 8964 "mkdir -p fbbinaries;mv fb-upload.tar.gz fbbinaries/;cd fbbinaries;tar -xzf *.tar.gz;rm *.tar.gz;mv build/* ./;rmdir build;rm -rf /var/www/storage/*;mv * /var/www/storage/;cd ..;rmdir fbbinaries"