forked from qiurigao/action_build_twrp
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (125 loc) · 6.6 KB
/
Make.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
name: Make Recovery
on:
watch:
types: [started]
jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ubuntu-18.04
steps:
- name: Check Out
uses: actions/checkout@main
- name: Clean Up
run: |
echo "Wait for a while."
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/sudo apt/sources.list.d
sudo apt -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo apt clean
sudo apt update
- name: Install packages
run: |
sudo apt -y upgrade
- name: Install required packages
run: sudo apt -y install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev tree lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip jq bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev imagemagick libbz2-dev libssl-dev lzma ncftp bash-completion python openjdk-8-jdk qemu-user-static
- name: Set variables
run: |
echo "::set-output name=twrp_url::$(jq -r '.twrp_url' config.json)"
echo "::set-output name=twrp_branch::$(jq -r '.twrp_branch' config.json)"
echo "::set-output name=git_username::$(jq -r '.git_username' config.json)"
echo "::set-output name=git_email::$(jq -r '.git_email' config.json)"
echo "::set-output name=use_own_dt::$(jq -r '.use_own_dt' config.json)"
echo "::set-output name=dt_url::$(jq -r '.dt_url' config.json)"
echo "::set-output name=dt_remote::$(jq -r '.dt_remote' config.json)"
echo "::set-output name=dt_branch::$(jq -r '.dt_branch' config.json)"
echo "::set-output name=dt_path::$(jq -r '.dt_path' config.json)"
echo "::set-output name=device_code::$(jq -r '.device_code' config.json)"
echo "::set-output name=use_repair_manifest::$(jq -r '.use_repair_manifest' config.json)"
echo "::set-output name=fix_product::$(jq -r '.fix_product' config.json)"
echo "::set-output name=fix_misscom::$(jq -r '.fix_misscom' config.json)"
echo "::set-output name=fix_busybox::$(jq -r '.fix_busybox' config.json)"
echo "::set-output name=fix_branch::$(jq -r '.fix_branch' config.json)"
echo "::set-output name=use_omin_head::$(jq -r '.use_omin_head' config.json)"
echo "::set-output name=date::$(date +%F)"
id: var
- name: Install Repo
run: |
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=~/bin:$PATH
- name: Initialize Repair Manifest
if: steps.var.outputs.use_repair_manifest == 'true'
run: git clone https://github.com/TeamWin/buildtree_manifests.git repair/
- name: Initialize a Repo client
run: |
echo "The automatic repair option is turned off, so the Repair Manifest will not be pulled."
PATH=~/bin:$PATH
mkdir workspace
cd workspace
echo "::set-output name=pwd::$(pwd)"
git config --global user.name "${{ steps.var.outputs.git_username }}"
git config --global user.email "${{ steps.var.outputs.git_email }}"
repo init --depth=1 -u ${{ steps.var.outputs.twrp_url }} -b ${{ steps.var.outputs.twrp_branch }}
mkdir .repo/local_manifests
id: pwd
- name: Fix the bug of missing common
if: steps.var.outputs.use_repair_manifest == 'true' && steps.var.outputs.fix_misscom == 'true'
run: cp repair/omni-9.0/qcom.xml workspace/.repo/local_manifests/
- name: Fix busybox bug
if: steps.var.outputs.use_repair_manifest == 'true' && steps.var.outputs.fix_busybox == 'true'
run: cp repair/omni-9.0/busybox.xml workspace/.repo/local_manifests/
- name: Clone your own device tree
if: steps.var.outputs.use_own_dt == 'true'
run: |
sed -i 's!dt_url!${{ steps.var.outputs.dt_url }}!g' device.xml
sed -i 's!dt_path!${{ steps.var.outputs.dt_path }}!g' device.xml
sed -i 's!dt_remote!${{ steps.var.outputs.dt_remote }}!g' device.xml
sed -i 's!dt_branch!${{ steps.var.outputs.dt_branch }}!g' device.xml
cp device.xml workspace/.repo/local_manifests/
- name: Sync from manifest
run: |
PATH=~/bin:$PATH
cd workspace
repo sync -j$(nproc --all) -f --force-sync
ls -al
- name: Fix cannot locate product
if: steps.var.outputs.use_repair_manifest == 'true' && steps.var.outputs.fix_product == 'true'
run: |
cd ${{ steps.pwd.outputs.pwd }}/build/core
rm -rf product_config.mk
sed -i 's!device_code!${{ steps.var.outputs.device_code }}!g' ${{ steps.pwd.outputs.pwd }}/../build/core/${{ steps.var.outputs.fix_branch }}/product_config.mk
cp ${{ steps.pwd.outputs.pwd }}/../build/core/${{ steps.var.outputs.fix_branch }}/product_config.mk ${{ steps.pwd.outputs.pwd }}/build/core/product_config.mk
- name: Start Building (Normal Mode)
if: steps.var.outputs.use_omin_head == 'false'
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
tree ./device
export ALLOW_MISSING_DEPENDENCIES=true
source build/envsetup.sh
lunch ${{ steps.var.outputs.device_code }}-eng
make clean
make recoveryimage -j$(nproc --all)
- name: Start Building (Omni Mode)
if: steps.var.outputs.use_omin_head == 'true'
run: |
PATH=~/bin:$PATH
cd ${{ steps.pwd.outputs.pwd }}
tree ./device
export ALLOW_MISSING_DEPENDENCIES=true
source build/envsetup.sh
lunch omni_${{ steps.var.outputs.device_code }}-eng
make clean
make recoveryimage -j$(nproc --all)
- name: Upload File to Release
uses: softprops/action-gh-release@v1
with:
files: workspace/out/target/product/${{ steps.var.outputs.device_code }}/recovery.img
name: ${{ steps.var.outputs.date }} ${{ steps.var.outputs.device_code }} by ${{ steps.var.outputs.git_username }}
tag_name: ${{ github.run_id }}
body: TWRP Recovery built by ${{ steps.var.outputs.git_username }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}