From 89bd7c6044dfebebb9d5e0e1717c785234ca1e74 Mon Sep 17 00:00:00 2001 From: Captain Throwback Date: Sun, 3 Jul 2022 17:43:41 -0400 Subject: [PATCH] Update repo for twrp-5.1 to twrp-12.1 tree support - Update defaults for 12.1 branch - Add support for custom build target - Add support for SSH keys - Customize OpenJDK install - Add more build info to release page - Add support for common trees - Display user variables at beginning of build - Update README for all relevant changes --- .github/workflows/Make.yml | 115 ---------------- .github/workflows/Make_Common.yml | 120 ----------------- .github/workflows/Recovery Build.yml | 194 +++++++++++++++++++++++++++ README.md | 71 ++++++++-- 4 files changed, 254 insertions(+), 246 deletions(-) delete mode 100644 .github/workflows/Make.yml delete mode 100644 .github/workflows/Make_Common.yml create mode 100644 .github/workflows/Recovery Build.yml diff --git a/.github/workflows/Make.yml b/.github/workflows/Make.yml deleted file mode 100644 index 6069405..0000000 --- a/.github/workflows/Make.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Normal - -on: - workflow_dispatch: - inputs: - MANIFEST_URL: - description: 'MANIFEST_URL' - required: true - default: 'https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git' - MANIFEST_BRANCH: - description: 'LIBRARY_BRANCH' - required: true - default: 'twrp-9.0' - DEVICE_TREE_URL: - description: 'DEVICE_TREE_URL' - required: true - default: 'https://github.com/azwhikaru/twrp_device_xiaomi_archytas' - DEVICE_TREE_BRANCH: - description: 'DEVICE_TREE_BRANCH' - required: true - default: 'twrp-9.0' - DEVICE_PATH: - description: 'DEVICE_PATH' - required: true - default: 'device/xiaomi/Archytas' - DEVICE_NAME: - description: 'DEVICE_NAME' - required: true - default: 'Archytas' - MAKEFILE_NAME: - description: 'MAKEFILE_NAME' - required: true - default: 'omni_Archytas' - -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: Prepare the environment - run: | - 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 - sudo apt -y upgrade - 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=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 repo - run: | - PATH=~/bin:$PATH - mkdir workspace - cd workspace - echo "::set-output name=pwd::$(pwd)" - git config --global user.name "Hikaru's Action-Build-Bot" - git config --global user.email "Android@teio.tk" - repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }} - id: pwd - - - name: Repo Sync - run: | - PATH=~/bin:$PATH - cd workspace - repo sync -j$(nproc --all) -c --no-clone-bundle --no-tags - rm -rf .repo - - - name: Clone device tree - run: | - PATH=~/bin:$PATH - cd ${{ steps.pwd.outputs.pwd }} - git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }} - - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 10 - - - name: Building recovery - run: | - PATH=~/bin:$PATH - cd ${{ steps.pwd.outputs.pwd }} - export ALLOW_MISSING_DEPENDENCIES=true - source build/envsetup.sh - lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng - make clean - make recoveryimage -j$(nproc --all) - - - name: Upload to Release - uses: softprops/action-gh-release@v1 - with: - files: workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery.img - name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }} - tag_name: ${{ github.run_id }} - body: Recovery for ${{ github.event.inputs.DEVICE_NAME }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/Make_Common.yml b/.github/workflows/Make_Common.yml deleted file mode 100644 index 71c262d..0000000 --- a/.github/workflows/Make_Common.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: Common - -on: - workflow_dispatch: - inputs: - MANIFEST_TYPE: - description: 'MANIFEST_TYPE' - required: true - default: 'omni' - MANIFEST_URL: - description: 'MANIFEST_URL' - required: true - default: 'https://github.com/SHRP/platform_manifest_twrp_omni.git' - MANIFEST_BRANCH: - description: 'MANIFEST_BRANCH' - required: true - default: 'v3_10.0' - DEVICE_TREE_URL: - description: 'DEVICE_TREE_URL' - required: true - default: 'https://github.com/SGCMarkus/android_device_lge_flashlmdd-twrp' - DEVICE_COMMON_URL: - description: 'DEVICE_COMMON_URL' - required: true - default: 'https://github.com/SGCMarkus/android_device_lge_sm8150-common-twrp' - DEVICE_TREE_BRANCH: - description: 'DEVICE_TREE_BRANCH' - required: true - default: 'android-10' - DEVICE_PATH: - description: 'DEVICE_PATH' - required: true - default: 'device/lge/flashlmdd' - DEVICE_COMMON_PATH: - description: 'DEVICE_COMMON_PATH' - required: true - default: 'device/lge/sm8150-common' - DEVICE_NAME: - description: 'DEVICE_NAME' - required: true - default: 'flashlmdd' - -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: Prepare the environment - run: | - 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 - 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=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 repo - run: | - PATH=~/bin:$PATH - mkdir workspace - cd workspace - echo "::set-output name=pwd::$(pwd)" - git config --global user.name "Hikaru's Action-Build-Bot" - git config --global user.email "Android@teio.tk" - repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }} - id: pwd - - - name: Repo Sync - run: | - PATH=~/bin:$PATH - cd workspace - repo sync -j$(nproc --all) -f --force-sync - - - name: Clone device - run: | - PATH=~/bin:$PATH - cd ${{ steps.pwd.outputs.pwd }} - git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }} - git clone ${{ github.event.inputs.DEVICE_COMMON_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_COMMON_PATH }} - - - name: Building - run: | - PATH=~/bin:$PATH - cd ${{ steps.pwd.outputs.pwd }} - export ALLOW_MISSING_DEPENDENCIES=true - source build/envsetup.sh - lunch ${{ github.event.inputs.MANIFEST_TYPE }}_${{ github.event.inputs.DEVICE_NAME }}-eng - make clean - make recoveryimage -j$(nproc --all) - - - name: Upload to Release - uses: softprops/action-gh-release@v1 - with: - files: | - workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.zip - workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery.img - workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.cpio - name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }} - tag_name: ${{ github.run_id }} - body: Recovery for ${{ github.event.inputs.DEVICE_NAME }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/Recovery Build.yml b/.github/workflows/Recovery Build.yml new file mode 100644 index 0000000..299ea31 --- /dev/null +++ b/.github/workflows/Recovery Build.yml @@ -0,0 +1,194 @@ +name: Recovery Build + +on: + workflow_dispatch: + inputs: + MANIFEST_URL: + description: 'MANIFEST_URL (if not using SSH keys, use https:// URL)' + required: true + default: 'git@github.com:minimal-manifest-twrp/platform_manifest_twrp_aosp.git' + MANIFEST_BRANCH: + description: 'MANIFEST_BRANCH' + required: true + default: 'twrp-12.1' + DEVICE_TREE_URL: + description: 'DEVICE_TREE_URL' + required: true + default: 'https://github.com/TeamWin/android_device_asus_I003D' + DEVICE_TREE_BRANCH: + description: 'DEVICE_TREE_BRANCH' + required: true + default: 'android-12.1' + DEVICE_PATH: + description: 'DEVICE_PATH' + required: true + default: 'device/asus/I003D' + COMMON_TREE_URL: + description: 'COMMON_TREE_URL (if no common tree, leave blank)' + required: false + COMMON_PATH: + description: 'COMMON_PATH (if no common tree, leave blank)' + required: false + DEVICE_NAME: + description: 'DEVICE_NAME' + required: true + default: 'I003D' + MAKEFILE_NAME: + description: 'MAKEFILE_NAME' + required: true + default: 'twrp_I003D' + BUILD_TARGET: + description: 'BUILD_TARGET' + required: true + default: 'recovery' + +jobs: + build: + if: github.event.repository.owner.id == github.event.sender.id + runs-on: ubuntu-18.04 + # You can use either of the ubuntu-18.04 or ubuntu-20.04 runner + steps: + - name: Display Run Parameters + run: | + echo "::group::User Environment Variables" + echo "Manifest URL: ${{ github.event.inputs.MANIFEST_URL }}" + echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}" + echo "Device Tree URL: ${{ github.event.inputs.DEVICE_TREE_URL }}" + echo "Device Tree Branch: ${{ github.event.inputs.DEVICE_TREE_BRANCH }}" + echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}" + echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img" + echo "::endgroup::" + + # You might want to Checkout your repo first, but not mandatory + - name: Check Out + uses: actions/checkout@v3 + # Cleanup The Actions Workspace Using Custom Composite Run Actions + - name: Cleanup + uses: rokibhasansagar/slimhub_actions@main + # That's it! Now use your normal steps + + - name: Prepare the environment + run: | + sudo apt update + sudo apt -y upgrade + sudo apt -y install gperf gcc-multilib gcc-10-multilib g++-multilib g++-10-multilib libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev tree lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc bc ccache lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev libxml2 lzop pngcrush schedtool squashfs-tools imagemagick libbz2-dev lzma ncftp python qemu-user-static libstdc++-10-dev + sudo apt-get update + sudo apt-get -y install --reinstall build-essential + + + - name: Install OpenJDK 7 + if: | + github.event.inputs.MANIFEST_BRANCH == 'twrp-5.1' + || github.event.inputs.MANIFEST_BRANCH == 'twrp-6.0' + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '7' + + - name: Install OpenJDK 8 + if: | + github.event.inputs.MANIFEST_BRANCH != 'twrp-5.1' + && github.event.inputs.MANIFEST_BRANCH != 'twrp-6.0' + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '8' + + - name: Verify Java Install + run: java -version + + - name: Setup SSH Keys + if: ${{ startsWith(github.event.inputs.MANIFEST_URL, 'git@github.com') }} + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: | + ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set variables + run: | + 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 repo + run: | + PATH=~/bin:$PATH + mkdir workspace + cd workspace + echo "::set-output name=pwd::$(pwd)" + git config --global user.name "Captain Throwback" + git config --global user.email "captainthrowback@hotmail.com" + repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }} + id: pwd + + - name: Repo Sync + run: | + PATH=~/bin:$PATH + cd workspace + repo sync -j$(nproc --all) -f --force-sync + ls -al + + - name: Clone device tree + run: | + PATH=~/bin:$PATH + cd ${{ steps.pwd.outputs.pwd }} + git clone ${{ github.event.inputs.DEVICE_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }} + + - name: Clone common tree + if: | + github.event.inputs.COMMON_TREE_URL != null + && github.event.inputs.COMMON_PATH != null + run: | + PATH=~/bin:$PATH + cd ${{ steps.pwd.outputs.pwd }} + git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }} + + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 12 + + - name: Check Build Branch - Step 1 + if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }} + run: | + PATH=~/bin:$PATH + cd ${{ steps.pwd.outputs.pwd }} + source build/envsetup.sh + repopick 5405 5540 + + - name: Check Build Branch - Step 2 + if: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-5.1' }} + run: | + PATH=~/bin:$PATH + cd ${{ steps.pwd.outputs.pwd }} + cd bootable/recovery + git fetch https://gerrit.twrp.me/android_bootable_recovery refs/changes/29/5729/1 && git cherry-pick FETCH_HEAD + + - name: Building recovery + run: | + PATH=~/bin:$PATH + cd ${{ steps.pwd.outputs.pwd }} + source build/envsetup.sh + lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng + export ALLOW_MISSING_DEPENDENCIES=true + make clean + make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all) + + - name: Upload to Release + uses: softprops/action-gh-release@v1 + with: + files: workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img + name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }} + tag_name: ${{ github.run_id }} + body: | + Manifest: ${{ github.event.inputs.MANIFEST_BRANCH }} + Device: ${{ github.event.inputs.DEVICE_NAME }} + Target: ${{ github.event.inputs.BUILD_TARGET }}.img + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 5903c55..fbf327e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,17 @@ Support OFRP, SHRP, TWRP compilation and production ## Release Notes ``` += 2022/07/06 +- Add support for 5.1 branch + += 2022/07/05 +- Updated to work with trees back to 6.0 +- Add conditionals to include common trees for syncing +- Update README for SSH keys + += 2022/07/04 +- Updated to work with Android 12.1 AOSP minimal TWRP manifest + = 2022/05/29 - Should work correctly with Android 11 based source code @@ -27,13 +38,16 @@ Support OFRP, SHRP, TWRP compilation and production | Name | Description | Example | | ------------ | -------------------- | ------------ | -| `MANIFEST_TYPE` | Source Type | omni | -| `MANIFEST_URL` | Source address| https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git | -| `MANIFEST_BRANCH` | Source branch | twrp-9.0 | -| `DEVICE_TREE_URL` | Device address| https://github.com/azwhikaru/twrp_device_xiaomi_archytas | -| `DEVICE_TREE_BRANCH` | Device branch | twrp-9.0 | -| `DEVICE_PATH` | Device location | device/xiaomi/Archytas | -| `DEVICE_NAME` | Model name | Archytas | +| `MANIFEST_URL` | Source address | https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git | +| `MANIFEST_BRANCH` | Source branch | twrp-12.1 | +| `DEVICE_TREE_URL` | Device address | https://github.com/TeamWin/android_device_asus_I003D | +| `DEVICE_TREE_BRANCH` | Device branch | android-12.1 | +| `DEVICE_PATH` | Device location | device/asus/I003D | +| `COMMON_TREE_URL` | Common tree address | https://github.com/TeamWin/android_device_asus_sm8250-common | +| `COMMON_PATH` | Common tree location | device/asus/sm8250-common | +| `DEVICE_NAME` | Model name | I003D | +| `MAKEFILE_NAME` | Makefile name | twrp_I003D | +| `BUILD_TARGET` | Build Target Partition (boot/recovery/vendorboot) | recovery | ----- @@ -45,11 +59,46 @@ For example, your username is: Fun-114514 ![](https://i.bmp.ovh/imgs/2021/10/6b6ed9f29e732372.png) #### 2. After waiting for the automatic redirection, you will see your own username ![](https://i.bmp.ovh/imgs/2021/10/66cfe324c0ebb69b.png) -#### 3. Click'Actions-Make Recovery' +#### 3. Change the [username and email](https://github.com/CaptainThrowback/Action-Recovery-Builder/blob/main/.github/workflows/Recovery%20Build.yml#L100-L101) in the workflow to reflect your Github credentials +## Setting up SSH Keys (optional) +#### 4. Go to Settings, then select Deploy keys and select "Add deploy key" button. + +#### 5. On your Android device, install [Termux](https://github.com/termux/termux-app/releases) + +#### 6. Install openssh in Termux and generate ssh keys. (Do not use passphrase for keys) +NOTE: When creating the deploy key for a repository like git@github.com:owner/repo.git or https://github.com/owner/repo, put that URL into the key comment. (Hint: Try ssh-keygen ... -C "git@github.com:owner/repo.git".) +owner = your Github username +``` +pkg install openssh +ssh-keygen -t ed25519 -C "git@github.com:owner/Action-Recovery-Builder.git" +``` +#### 7. Add the keys to your repo. In Termux, use the following commands: +``` +cd /data/data/com.termux/files/usr/etc/ssh +cat ssh_host_ed25519_key.pub +``` + Select and copy the key then paste in the box for Key. + You can name it whatever you choose for the title. + +#### 8. Now to add your private ssh key. Back in Termux: +``` +cat ssh_host_ed25519_key +``` + Copy the output from Termux. + + In your browser, select *Secrets* under the Security tab. + Select Actions + Select New repository secret + For the New secret name, it should be SSH_PRIVATE_KEY + Paste the output from ssh_host_ed25519_key into the Value box. + Then select Add secret. + +## Building the Recovery +#### 9. Click'Actions-Recovery Build' ![](https://i.bmp.ovh/imgs/2021/10/23896d1b66292047.png) -#### 4. Click'Run workflow' and fill in according to the above'parameter description' +#### 10. Click'Run workflow' and fill in according to the above'parameter description' ![](https://i.bmp.ovh/imgs/2021/10/9cb7871267cf2f53.png) -#### 5. After filling in, click'Run workflow' to start running +#### 11. After filling in, click'Run workflow' to start running ----- @@ -59,6 +108,6 @@ Can be downloaded at [Release](../../releases) ----- ## Remark -#### TeamWin Recovery Project: https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git +#### TeamWin Recovery Project: https://github.com/minimal-manifest-twrp #### OrangeFox Recovery Project: https://gitlab.com/OrangeFox/Manifest.git #### SKYHAWK Recovery Project: https://github.com/SHRP/platform_manifest_twrp_omni.git