Build binaries and Upload to Release #29
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
name: Build binaries and Upload to Release | |
on: | |
push: | |
branches: [ Personal ] | |
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 current | |
# - name: Package for specific platforms | |
# run: | | |
# export THEOS=~/theos | |
# make package | |
- name: Archive binaries | |
run: | | |
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.txt)" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: softprops/action-gh-release@v0.1.14 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: v${{ steps.release_version.outputs.release_version }} | |
target_commitish: Personal | |
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" | |