-
Notifications
You must be signed in to change notification settings - Fork 418
143 lines (125 loc) · 5.87 KB
/
SGSI_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
name: SGSI_Build
on:
workflow_dispatch:
inputs:
ROM_URL:
description: 'ROM_URL'
required: true
default: 'https://hugeota.d.miui.com/21.5.31/miui_TUCANA_21.5.31_cb42ec9bed_11.0.zip'
ZIP_NAME:
description: 'ZIP_NAME'
required: true
default: 'miui_TUCANA_21.5.31_cb42ec9bed_11.0.zip'
OS_TYPE:
description: 'OS_TYPE'
required: true
default: 'miui'
SGSI_TYPE:
description: 'SGSI_TYPE(AB, A, or BOTH)'
required: true
default: 'AB'
REPACK_NAME:
description: 'REPACK_NAME'
required: true
default: 'SGSI.zip'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Get the source code of this repositorie...
uses: actions/checkout@main
- name: Get variable configuration...
run: |
echo "BUILD_TIME=$(date +%s | md5sum | awk '{print substr($1,1,10)}')" >> $GITHUB_ENV
- name: Clean up the environment...
run: |
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo -E apt-get update
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
df -h
- name: Configuration Environment...
run: |
sudo apt-get install -y git wget git zip unzip curl axel
- name: Get the SGSI tool...
run: |
git clone --recurse-submodules https://github.com/xiaoxindada/SGSI-build-tool.git -b 11 $GITHUB_WORKSPACE/Tool-SGSI-build
- name: Replace custom condensed content...
run: |
sudo rm -rf $GITHUB_WORKSPACE/Tool-SGSI-build/apps_clean
sudo cp -r apps_clean $GITHUB_WORKSPACE/Tool-SGSI-build/apps_clean
sudo chmod 777 -R $GITHUB_WORKSPACE/Tool-SGSI-build
- name: Download ROM...
run: |
cd $GITHUB_WORKSPACE/Tool-SGSI-build
mkdir ./tmp
wget -U "Mozilla/5.0" ${{ github.event.inputs.ROM_URL }} -O "$GITHUB_WORKSPACE/Tool-SGSI-build/tmp/${{ github.event.inputs.ZIP_NAME }}"
echo "zip_file: $(ls "$GITHUB_WORKSPACE/Tool-SGSI-build/tmp/")"
- name: Configuration tool environment...
run: |
sudo sed -i 's/USE_MIRROR_FOR_PIP\=true/USE_MIRROR_FOR_PIP\=false/' $GITHUB_WORKSPACE/Tool-SGSI-build/setup.sh
sudo bash $GITHUB_WORKSPACE/Tool-SGSI-build/setup.sh
java -version
- name: Make AB type GSI...
if: ${{ github.event.inputs.SGSI_TYPE }} == 'AB' || ${{ github.event.inputs.SGSI_TYPE }} == 'BOTH'
run: |
sudo bash $GITHUB_WORKSPACE/Tool-SGSI-build/make.sh AB << EOF
${{ github.event.inputs.ZIP_NAME }}
y
y
${{ github.event.inputs.OS_TYPE }}
y
- name: Packing(AB)...
if: ${{ github.event.inputs.SGSI_TYPE }} == 'AB' || ${{ github.event.inputs.SGSI_TYPE }} == 'BOTH'
run: |
cd $GITHUB_WORKSPACE/Tool-SGSI-build
pwd
zip -r AB_${{ github.event.inputs.REPACK_NAME }} SGSI/*
ls "AB_${{ github.event.inputs.REPACK_NAME }}"
echo "--------------------------------------"
ls
echo "--------------------------------------"
mkdir upload_ab
echo "--------------------------------------"
ls upload_ab
echo "--------------------------------------"
if [ $(ls -l AB_${{ github.event.inputs.REPACK_NAME }} | awk '{print $5}') -gt 2147483647 ]; then tar cvzpf - AB_${{ github.event.inputs.REPACK_NAME }} | split -d -b 1024m - upload_ab/AB_${{ github.event.inputs.REPACK_NAME }}; else mv AB_${{ github.event.inputs.REPACK_NAME }} upload_ab/AB_${{ github.event.inputs.REPACK_NAME }}; fi
echo "--------------------------------------"
ls upload_ab
echo "--------------------------------------"
- name: Make A-only type GSI...
if: ${{ github.event.inputs.SGSI_TYPE }} == 'A' || ${{ github.event.inputs.SGSI_TYPE }} == 'BOTH'
run: |
sudo bash $GITHUB_WORKSPACE/Tool-SGSI-build/make.sh A << EOF
${{ github.event.inputs.ZIP_NAME }}
y
y
${{ github.event.inputs.OS_TYPE }}
y
- name: Packing(A-only)...
if: ${{ github.event.inputs.SGSI_TYPE }} == 'A' || ${{ github.event.inputs.SGSI_TYPE }} == 'BOTH'
run: |
cd $GITHUB_WORKSPACE/Tool-SGSI-build
pwd
zip -r AONLY_${{ github.event.inputs.REPACK_NAME }} SGSI/*
ls "AONLY_${{ github.event.inputs.REPACK_NAME }}"
echo "--------------------------------------"
ls
echo "--------------------------------------"
mkdir upload_aonly
echo "--------------------------------------"
ls upload_aonly
echo "--------------------------------------"
if [ $(ls -l AONLY_${{ github.event.inputs.REPACK_NAME }} | awk '{print $5}') -gt 2147483647 ]; then tar cvzpf - AONLY_${{ github.event.inputs.REPACK_NAME }} | split -d -b 1024m - upload_aonly/AONLY_${{ github.event.inputs.REPACK_NAME }}; else mv AONLY_${{ github.event.inputs.REPACK_NAME }} upload_aonly/AONLY_${{ github.event.inputs.REPACK_NAME }}; fi
echo "--------------------------------------"
ls upload_aonly
echo "--------------------------------------"
- name: Upload to Release...
uses: ncipollo/[email protected]
with:
artifacts: "${{ github.workspace }}/Tool-SGSI-build/upload_ab/*,${{ github.workspace }}/Tool-SGSI-build/upload_aonly/*"
tag: "${{ github.event.inputs.REPACK_NAME }}_${{ env.BUILD_TIME }}"
bodyFile: "${{ github.workspace }}/Tool-SGSI-build/SGSI/build_info.txt"
token: ${{ secrets.GITHUB_TOKEN }}