Build QyzROM for S23 Series #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build QyzROM for S23 Series | |
| permissions: | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.device.name }} | |
| runs-on: ubuntu-latest | |
| container: | |
| image: fedora:42 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| device: | |
| - model: SM-S9110 | |
| name: S23 (SM-S9110) | |
| serial: RFCW81DHWWP | |
| - model: SM-S9160 | |
| name: S23+ (SM-S9160) | |
| serial: R5CW23450PZ | |
| - model: SM-S9180 | |
| name: S23 Ultra (SM-S9180) | |
| serial: R5CW139E77Z | |
| env: | |
| MODEL: ${{ matrix.device.model }} | |
| DEVICE_NAME: ${{ matrix.device.name }} | |
| DEVICE_SERIAL: ${{ matrix.device.serial }} | |
| steps: | |
| - name: Install git first (required for checkout) | |
| run: | | |
| dnf -y update | |
| dnf -y install git | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Checkout another repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: qlenlen/TIK_mine | |
| ref: master | |
| token: ${{ secrets.TOKEN }} | |
| path: qyz | |
| submodules: recursive | |
| # ⚠️ 容器内无需 free-disk-space,且该 action 在 container 下无效 | |
| - name: Install system dependencies (Fedora) | |
| run: | | |
| dnf -y update | |
| dnf -y install \ | |
| git curl jq zip tar cpio lz4 flex xxd patchelf \ | |
| python3 python3-pip which findutils | |
| - name: Set up git identity | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Install Python dependencies | |
| run: | | |
| python3 --version | |
| pip3 install --upgrade pip | |
| pip3 install -r qyz/requirements.txt | |
| - name: Download firmware | |
| run: | | |
| git clone https://github.com/keklick1337/gnsf.git | |
| cd gnsf | |
| mkdir -p ../qyz/UI7 | |
| pip3 install -r requirements.txt | |
| ROM_VERSION=$(./gnsf.py -m "$MODEL" -r CHC check | grep -oP 'Firmware:\s*\K\S+' | cut -d'/' -f1) | |
| echo "ROM Version: $ROM_VERSION" | |
| echo "ROM_VERSION=$ROM_VERSION" >> "$GITHUB_ENV" | |
| ./gnsf.py -m "$MODEL" -r CHC -s "$DEVICE_SERIAL" download -O ../qyz/UI7 | |
| ls -lh ../qyz/UI7 | |
| - name: Build ROM | |
| env: | |
| RUN_EXTRA_STEPS: "1" | |
| run: | | |
| cd qyz | |
| export PYTHONPATH=$(pwd) | |
| python3 src/device/dmXq_chn.py | |
| - name: Upload to GoFile | |
| id: upload | |
| run: | | |
| ZIP_FILE=$(find qyz/UI7 -maxdepth 1 -type f -name "*.zip" | head -n 1) | |
| if [ -z "$ZIP_FILE" ]; then | |
| echo "No ZIP file found!" | |
| exit 1 | |
| fi | |
| NEW_ZIP_NAME="QyzROM_CHC_${{ env.ROM_VERSION }}_${{ env.MODEL }}.zip" | |
| mv "$ZIP_FILE" "qyz/UI7/$NEW_ZIP_NAME" | |
| RESPONSE=$(curl -s \ | |
| -F "file=@qyz/UI7/$NEW_ZIP_NAME" \ | |
| -F "token=${{ secrets.GOFILE_TOKEN }}" \ | |
| -F "folderId=${{ secrets.GOFILE_FOLDER_ID }}" \ | |
| "https://upload-eu-par.gofile.io/uploadFile") | |
| echo "Upload response: $RESPONSE" | |
| URL=$(echo "$RESPONSE" | jq -r '.data.downloadPage') | |
| if [ -z "$URL" ] || [ "$URL" = "null" ]; then | |
| echo "Failed to parse download URL from GoFile response" | |
| exit 1 | |
| fi | |
| echo "download_url=$URL" >> "$GITHUB_OUTPUT" | |
| - name: Save release info | |
| run: | | |
| name='${{ env.DEVICE_NAME }}' | |
| url='${{ steps.upload.outputs.download_url }}' | |
| model='${{ env.MODEL }}' | |
| rom='${{ env.ROM_VERSION }}' | |
| { | |
| printf "name=%q\n" "$name" | |
| printf "url=%q\n" "$url" | |
| printf "model=%q\n" "$model" | |
| printf "rom_version=%q\n" "$rom" | |
| } > "release-info-${{ env.MODEL }}.env" | |
| - name: Upload release info artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-info-${{ env.MODEL }} | |
| path: release-info-${{ env.MODEL }}.env | |
| release: | |
| name: Create unified release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all release infos | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: release-info-* | |
| merge-multiple: true | |
| - name: Compute tag and generate release body | |
| id: gen | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "这是一个自动构建的ROM,适用于 S23 系列以下机型:" > release_body.md | |
| first=1 | |
| shopt -s nullglob | |
| for f in release-info-*.env; do | |
| source "$f" | |
| echo "" >> release_body.md | |
| echo "**${name}**" >> release_body.md | |
| echo "下载链接: ${url}" >> release_body.md | |
| if [ "$first" -eq 1 ] && [ -n "${rom_version:-}" ]; then | |
| echo "rom_version=${rom_version}" >> "$GITHUB_OUTPUT" | |
| first=0 | |
| fi | |
| done | |
| echo "" >> release_body.md | |
| echo "内核为 KernelSU LKM,需安装官方 APK 以激活 root 权限" >> release_body.md | |
| echo "" >> release_body.md | |
| echo "> WARNING! THESE BUILDS MAY NOT BE BOOTABLE. FLASH ONLY FOR TESTING PURPOSES IF THE DEVELOPER TOLD YOU." >> release_body.md | |
| - name: Validate computed tag | |
| run: | | |
| if [ -z "${{ steps.gen.outputs.rom_version }}" ]; then | |
| echo "No rom_version found in artifacts!" | |
| ls -l | |
| exit 1 | |
| fi | |
| - name: Create unified release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| removeArtifacts: true | |
| name: QyzROM_CHC_${{ steps.gen.outputs.rom_version }} | |
| tag: ${{ steps.gen.outputs.rom_version }} | |
| bodyFile: release_body.md | |
| token: ${{ secrets.GITHUB_TOKEN }} |