Skip to content

Commit

Permalink
feat: 初次上传
Browse files Browse the repository at this point in the history
  • Loading branch information
XayahSuSuSu committed Jun 4, 2021
1 parent 1b3487d commit c5061de
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 101 deletions.
151 changes: 70 additions & 81 deletions .github/workflows/SGSI_Build.yml
Original file line number Diff line number Diff line change
@@ -1,96 +1,85 @@
# This is a basic workflow to help you get started with Actions

name: SGSI_Build

on:
watch:
types: [started]

env:
ROM_URL: 'https://dl.google.com/developers/android/sc/images/ota/redfin-ota-spp2.210219.008-3d61e529.zip'
ZIP_NAME: 'update.zip'
OS_TYPE: 'Pixel'
BUILD_TYPE: 'ab'
REPACK_NAME: 'SGSI.zip'
VERSION: '12'
upload_WeTransfer: 'true'
upload_action-gh-release: 'false'
SETUP: 'true'


jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@main

- name: Clean Up
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: Setting up the SPICES
run: |
sudo apt-get install -y git wget git zip unzip curl axel
- name: 获取本仓库源码...
uses: actions/checkout@main

- name: 获取变量配置...
run: |
echo "BUILD_TIME=$(date +%s | md5sum | awk '{print substr($1,1,10)}')" >> $GITHUB_ENV
- name: 清理环境...
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: 配置环境...
run: |
sudo apt-get install -y git wget git zip unzip curl axel
- name: 获取SGSI工具...
run: |
git clone https://gitlab.com/Xayah/Tool-SGSI-build $GITHUB_WORKSPACE/Tool-SGSI-build
- name: Cloning...
run: |
git clone https://github.com/xiaoxindada/SGSI-build-tool.git -b 12 $GITHUB_WORKSPACE/SGSI-build-tool
- name: Download zip...
run: |
cd $GITHUB_WORKSPACE/SGSI-build-tool
mkdir ./tmp
axel -n $(nproc) -U "Mozilla/5.0" $ROM_URL -o "$GITHUB_WORKSPACE/SGSI-build-tool/tmp/$ZIP_NAME" || wget -U "Mozilla/5.0" $ROM_URL -O "$GITHUB_WORKSPACE/SGSI-build-tool/tmp/$ZIP_NAME"
echo "zip_file: $(ls "$GITHUB_WORKSPACE/SGSI-build-tool/tmp/")"
- name: Setup Tool Utils...
if: env.SETUP == 'true'
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: Building AB DEVICES SGSI...
if: env.BUILD_TYPE == 'AB' || env.BUILD_TYPE == 'ab'
run: |
sudo bash $GITHUB_WORKSPACE/SGSI-build-tool/make.sh --AB $OS_TYPE $ZIP_NAME --fix-bug
- name: 下载ROM...
run: |
cd $GITHUB_WORKSPACE/Tool-SGSI-build/11
mkdir ./tmp
axel -n $(nproc) -U "Mozilla/5.0" ${{ secrets.ROM_URL }} -o "$GITHUB_WORKSPACE/Tool-SGSI-build/11/tmp/${{ secrets.ZIP_NAME }}" || wget -U "Mozilla/5.0" ${{ secrets.ROM_URL }} -O "$GITHUB_WORKSPACE/Tool-SGSI-build/11/tmp/${{ secrets.ZIP_NAME }}"
echo "zip_file: $(ls "$GITHUB_WORKSPACE/Tool-SGSI-build/11/tmp/")"
- name: Building A-only DEVICES SGSI...
if: env.BUILD_TYPE == 'a-only'
run: |
sudo bash $GITHUB_WORKSPACE/SGSI-build-tool/make.sh --a-only $OS_TYPE $ZIP_NAME --fix-bug
- name: 配置工具环境...
if: env.SETUP == 'true'
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
sudo apt-get -y --purge remove "adoptopenjdk-11-hotspot"
java -version
- name: Repack output file ...
run: |
cd $GITHUB_WORKSPACE/SGSI-build-tool
pwd
zip -r $REPACK_NAME ./SGSI/*
ls "$REPACK_NAME"
- name: 制作AB型GSI...
run: |
sudo bash $GITHUB_WORKSPACE/Tool-SGSI-build/11/make.sh AB << EOF
${{ secrets.ZIP_NAME }}
y
y
${{ secrets.OS_TYPE }}
y
- name: Upload SGSI to WeTransfer...
if: env.upload_WeTransfer == 'true'
run: |
cd $GITHUB_WORKSPACE/SGSI-build-tool
pwd
ls "$REPACK_NAME"
curl -sL https://git.io/file-transfer | sh
./transfer wet ./$REPACK_NAME
- name: 打包...
run: |
cd $GITHUB_WORKSPACE/Tool-SGSI-build/11
pwd
zip -r ${{ secrets.REPACK_NAME }} SGSI/*
ls "${{ secrets.REPACK_NAME }}"
echo "--------------------------------------"
ls
echo "--------------------------------------"
mkdir upload
echo "--------------------------------------"
ls upload
echo "--------------------------------------"
if [ $(ls -l ${{ secrets.REPACK_NAME }} | awk '{print $5}') -gt 2147483647 ]; then tar cvzpf - ${{ secrets.REPACK_NAME }} | split -d -b 1024m - upload/${{ secrets.REPACK_NAME }}; else mv ${{ secrets.REPACK_NAME }} upload/${{ secrets.REPACK_NAME }}; fi
echo "--------------------------------------"
ls upload
echo "--------------------------------------"
- name: Upload SGSI to action-gh-release...
if: env.upload_action-gh-release == 'true'
uses: softprops/action-gh-release@v1
with:
files: ${{ github.workspace }}/SGSI-build-tool/${{ env.REPACK_NAME }}
name: xiaoxinSGSI-${{ env.OS_TYPE }}-${{ env.BUILD_TYPE }}-Android${{ env.VERSION }}-unpack
tag_name: 12
#body: Use actions auto bulid
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 上传至Release
uses: ncipollo/[email protected]
with:
artifacts: "${{ github.workspace }}/Tool-SGSI-build/11/upload/*"
tag: "${{ secrets.REPACK_NAME }}_${{ env.BUILD_TIME }}"
body: "${{ secrets.REPACK_NAME }}_${{ env.BUILD_TIME }}"
token: ${{ secrets.GITHUB_TOKEN }}
57 changes: 37 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
# SGSI-build-action
# Action-SGSI-build

**不要直接在此仓库跑包,跑包请fork此仓库到然后去你自己的GitHub里再跑 !**
**Don't build directly in this warehouse, please fork this warehouse first, and then go to your own warehouse to build!**
> 适配Android R
>
> 修复制作超过2G的SGSI无法上传Release的问题
## 快速开始

1. Fork此仓库

首次使用时,你需要先**Fork此仓库**,然后再进行参数配置

2. 配置参数

假设你此时已经Fork本仓库并进入自己的仓库,点击菜单中 **Settings - Secrets - New repository secret**

按下表新建加密环境变量

|说明 |Name |Value(按你自己的需求填写) |
|:------: |:------: | :------------------------: |
|待制作包链接 |ROM_URL |https://hugeota.d.miui.com/21.5.31/miui_TUCANA_21.5.31_cb42ec9bed_11.0.zip|
|待制作包名称 |ZIP_NAME |miui_TUCANA_21.5.31_cb42ec9bed_11.0.zip |
|待制作包种类 |OS_TYPE |miui |
|打包名称 |REPACK_NAME|SGSI.zip |

## 后续步骤

由于[Github large binaries](https://docs.github.com/en/github/managing-large-files/working-with-large-files/distributing-large-binaries)限制,制作后的SGSI若超过**2GB****无法上传**,因此本Action将自动根据制作后的SGSI大小选择**直接上传**/**分卷上传**

若以分卷方式上传,请下载每个分卷后手动合卷解压

## 使用方法:
```
1. fork此仓库
2. 编辑SGSI_Build.yml:
ROM_URL: 为你的下载连接
ZIP_NAME: 为你下载的包名
OS_TYPE: 为你要跑的rom类型
BUILD_TYPE: 为你需要build的类型(ab|a-only)
REPACK_NAME: 为你需要打包的包名
3. 修改完毕后依次点击Start commit -> Actions选项卡 -> Star -> SGSI-Build
cat ${fileName}*>${fileName}.tar.gz # 将分卷文件fileName*合并
tar xzvf ${fileName}.tar.gz # 解压
```

## 输出结果
如果将rom上传至Release下载 请修改yml的 upload_action-gh-release: 'false' -> 'true'
每次构建成功后山除掉 自动上传的的版本否则下次将会上传失败
结果在[Release](../../releases)下载

如果将rom上传至WeTransfer下载 清修改yml的 upload_WeTransfer: 'false' -> 'true'
上传好后的下载链接,留意输出结果 Download Link:

## 版权与致谢

本项目受 [SGSI-build-action](https://github.com/xiaoxindada/SGSI-build-action) 项目启发。

感谢[xiaoxindada](https://github.com/xiaoxindada)的开源。

0 comments on commit c5061de

Please sign in to comment.