Skip to content

SGSI_Build

SGSI_Build #229

Workflow file for this run

name: SGSI_Build
on:
watch:
types: [started]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Load Configuration
uses: falti/dotenv-action@v0.2.5
id: config
with:
path: config.env
- name: Check Configuration
run: |
function required () { if ! [[ "$1" ]]; then echo "$2 variable can't be null." && exit 1; fi }
required "${{ steps.config.outputs.rom_url }}" "ROM_URL config"
required "${{ steps.config.outputs.build_type }}" "BUILD_TYPE config"
required "${{ steps.config.outputs.os_type }}" "OS_TYPE config"
required "${{ steps.config.outputs.zip_name }}" "ZIP_NAME config"
required "${{ steps.config.outputs.version }}" "VERSION config"
required "${{ steps.config.outputs.repack_name }}" "REPACK_NAME config"
- name: Cleanup workspace
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* php*
sudo -E apt-get update
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
df -h
- name: Initializing Environment
run: |
sudo apt-get install -y git wget git zip unzip curl axel
- name: Cloning SGSI source code
run: |
git clone --recurse-submodules https://github.com/xiaoxindada/SGSI-build-tool.git -b 12 $GITHUB_WORKSPACE/SGSI-build-tool
- name: Setup sGSI tools requirements
run: |
sudo sed -i 's/USE_MIRROR_FOR_PIP\=true/USE_MIRROR_FOR_PIP\=false/' $GITHUB_WORKSPACE/SGSI-build-tool/setup.sh
sudo bash $GITHUB_WORKSPACE/SGSI-build-tool/setup.sh
# sudo apt-get -y --purge remove "adoptopenjdk-11-hotspot"
# java -version
- name: Build SGSI
run: |
cd $GITHUB_WORKSPACE/SGSI-build-tool
sudo bash ./url2SGSI.sh "${{ steps.config.outputs.rom_url }}" "${{ steps.config.outputs.os_type }}" "${{ steps.config.outputs.build_type }}"
- name: Repack Output File
run: |
cd $GITHUB_WORKSPACE/SGSI-build-tool
mkdir -p upload
zip -r ${{ steps.config.outputs.repack_name }} ./SGSI/*
if [[ $(du -sb "${{ steps.config.outputs.repack_name }}" | awk '{print $1}') -gt 2097152000 ]];then
echo -e "split packaging..."
tar -cpzf - "${{ steps.config.outputs.repack_name }}" | split -d -b 1024m - "upload/${{ steps.config.outputs.repack_name }}"
else
mv "${{ steps.config.outputs.repack_name }}" "upload/${{ steps.config.outputs.repack_name }}"
fi
ls "upload"
- name: Upload SGSI to GH-Release
uses: ncipollo/release-action@v1.8.6
with:
artifacts: ${{ github.workspace }}/SGSI-build-tool/upload/*
name: "${{ steps.config.outputs.os_type }}${{ steps.config.outputs.build_type }}-Android${{ steps.config.outputs.version }}-unpack"
tag: "${{ steps.config.outputs.os_type }}${{ steps.config.outputs.build_type }}-${{ steps.config.outputs.version }}-${{ github.run_number }}"
bodyFile: "${{ github.workspace}}/SGSI-build-tool/SGSI/build_info.txt"
token: ${{ secrets.GITHUB_TOKEN }}