forked from carlodandan/OrangeFox-Action-Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (126 loc) · 5.11 KB
/
OrangeFox-Compile.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
name: OrangeFox - Build
# Credits to:
# https://github.com/TeamWin
# https://gitlab.com/OrangeFox
# https://github.com/azwhikaru for Recovery Builder Template
# And all Contributors in every repositories I used
on:
workflow_dispatch:
inputs:
MANIFEST_BRANCH:
description: 'OrangeFox Manifest Branch'
required: true
default: '12.1'
type: choice
options:
- 12.1
- 11.0
DEVICE_TREE:
description: 'OrangeFox Device Tree'
required: true
default: 'https://github.com/cachiusa/orangefox_device_xiaomi_veux'
DEVICE_TREE_BRANCH:
description: 'OrangeFox Device Tree Branch'
required: true
default: 'staging'
DEVICE_PATH:
description: 'Specify your Device Path'
required: true
default: 'device/xiaomi/veux'
DEVICE_NAME:
description: 'Specify your Device Codename'
required: true
default: 'veux'
BUILD_TARGET:
description: 'Specify your Build Target'
required: true
default: 'vendorboot'
type: choice
options:
- boot
- recovery
- vendorboot
USE_CCACHE:
description: Use ccache for compilation
type: boolean
required: true
default: false
jobs:
build:
name: Build OFR by ${{ github.actor }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clean-up
uses: rokibhasansagar/slimhub_actions@main
- name: Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 24
- name: Build Environment
run: |
sudo apt install aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts.git -b master
cd scripts
sudo bash setup/android_build_env.sh
- name: Setup ccache
uses: hendrikmuhs/[email protected]
if: github.event.inputs.USE_CCACHE == 'true'
with:
max-size: "10G"
- name: Set-up Manifest
if: github.event.inputs.MANIFEST_BRANCH == '11.0' || github.event.inputs.MANIFEST_BRANCH == '12.1'
run: |
mkdir -p ${GITHUB_WORKSPACE}/OrangeFox
cd ${GITHUB_WORKSPACE}/OrangeFox
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git clone https://gitlab.com/OrangeFox/sync.git -b master
cd sync
./orangefox_sync.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
- name: Clone Device Tree
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
curl -LSs https://gist.github.com/cachiusa/112d89e2abac7e33c87948ff44406a31/raw -o lzma.sh
chmod +x lzma.sh
sed -i '/# clean up, with success code/a cd $ANDROID_BUILD_TOP && ./lzma.sh $ZIP_FILE' vendor/recovery/OrangeFox_A12.sh
cd ${{ github.event.inputs.DEVICE_PATH }}
echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Building OrangeFox
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
set +e
if [[ ${{ github.event.inputs.USE_CCACHE }} == true ]]; then
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
sed -i 's/return sandboxConfig\.working/return false/g' build/soong/ui/build/sandbox_linux.go
fi
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch twrp_${{ github.event.inputs.DEVICE_NAME }}-eng && mka adbd vendorbootimage
export TW_VNDR_BOOT=0
source build/envsetup.sh
lunch twrp_veux-eng && mka adbd bootimage
- name: Set Release Properties
run: |
echo "BUILD_DATE=$(TZ=Asia/Manila date +%Y%m%d)" >> $GITHUB_ENV
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
files: |
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip
name: OrangeFox Recovery for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
tag_name: ${{ github.run_id }}
body: |
## OrangeFox Recovery Build - Unofficial
Build: fox_${{ github.event.inputs.MANIFEST_BRANCH }}
Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.