Skip to content

Commit

Permalink
このレポジトリからデバイスツリーを持ってくる
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseos authored May 23, 2024
1 parent 4ae962e commit 767fe67
Showing 1 changed file with 48 additions and 58 deletions.
106 changes: 48 additions & 58 deletions .github/workflows/build_twrp.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
name: Recovery Build (Legacy)

on:
workflow_dispatch:
inputs:
MANIFEST_URL:
description: 'MANIFEST_URL (if want to use SSH keys, use [email protected]:XXXXX)'
required: true
default: 'https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni'
MANIFEST_BRANCH:
description: 'MANIFEST_BRANCH'
required: true
default: 'twrp-9.0'
DEVICE_PATH:
description: 'DEVICE_PATH'
required: true
default: 'device/sts/a05bd'
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: 'a05bd'
MAKEFILE_NAME:
description: 'MAKEFILE_NAME'
required: true
default: 'omni_a05bd'
BUILD_TARGET:
description: 'BUILD_TARGET'
required: true
default: 'recovery'
push:
branches:
- main # 実行するブランチを指定

env:
MANIFEST_URL: 'https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni'
MANIFEST_BRANCH: 'twrp-9.0'
DEVICE_TREE_URL: 'https://github.com/mouseos/android_device_sts-tottori_a05bd'
DEVICE_TREE_BRANCH: 'main'
DEVICE_PATH: 'device/sts/a05bd'
DEVICE_NAME: 'a05bd'
MAKEFILE_NAME: 'omni_a05bd'
BUILD_TARGET: 'recovery'
# COMMON_TREE_URLとCOMMON_PATHを必要に応じて指定してください

jobs:
build:
Expand All @@ -44,21 +26,21 @@ jobs:
- 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 Path: ${{ github.event.inputs.DEVICE_PATH }}"
echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
echo "Makefile Name: ${{ github.event.inputs.MAKEFILE_NAME }}"
echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}.img"
echo "Manifest URL: $MANIFEST_URL"
echo "Manifest Branch: $MANIFEST_BRANCH"
echo "Device Tree URL: $DEVICE_TREE_URL"
echo "Device Tree Branch: $DEVICE_TREE_BRANCH"
echo "Device Path: $DEVICE_PATH"
echo "Device Name: $DEVICE_NAME"
echo "Makefile Name: $MAKEFILE_NAME"
echo "Build Target: $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: |
Expand All @@ -73,7 +55,7 @@ jobs:
java-version: '8'

- name: Setup SSH Keys
if: ${{ startsWith(github.event.inputs.MANIFEST_URL, '[email protected]') }}
if: ${{ startsWith(env.MANIFEST_URL, '[email protected]') }}
uses: webfactory/[email protected]
with:
ssh-private-key: |
Expand All @@ -93,27 +75,35 @@ jobs:
echo "workspace-folder=$(pwd)" >> $GITHUB_OUTPUT
git config --global user.name "azwhikaru"
git config --global user.email "[email protected]"
repo init --depth=1 -u ${{ github.event.inputs.MANIFEST_URL }} -b ${{ github.event.inputs.MANIFEST_BRANCH }}
repo init --depth=1 -u $MANIFEST_URL -b $MANIFEST_BRANCH
id: pwd

- name: Repo Sync
run: |
repo sync -j$(nproc --all) --force-sync
working-directory: workspace

- name: Move device tree
- name: Move repository files
run: |
mv ./${{ github.event.inputs.DEVICE_NAME }} ./${{ steps.pwd.outputs.workspace-folder }}/${{ github.event.inputs.DEVICE_PATH }}
working-directory: .

shopt -s extglob
mv !(device|.github) $DEVICE_PATH/
working-directory: ${{ steps.pwd.outputs.workspace-folder }}

- name: Clone common tree
if: |
github.event.inputs.COMMON_TREE_URL != null
&& github.event.inputs.COMMON_PATH != null
env.COMMON_TREE_URL != null
&& env.COMMON_PATH != null
run: |
git clone ${{ github.event.inputs.COMMON_TREE_URL }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.COMMON_PATH }}
git clone $COMMON_TREE_URL -b $DEVICE_TREE_BRANCH ./$COMMON_PATH
working-directory: ${{ steps.pwd.outputs.workspace-folder }}

- name: Sync Device Dependencies
run: |
bash ${GITHUB_WORKSPACE}/scripts/convert.sh $DEVICE_PATH/${{ steps.buildtree.outputs.value }}.dependencies
repo sync -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}
continue-on-error: true

- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
Expand All @@ -131,21 +121,21 @@ jobs:
run: |
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
lunch $MAKEFILE_NAME-eng && make clean && make $BUILD_TARGETimage -j$(nproc --all)
working-directory: ${{ steps.pwd.outputs.workspace-folder }}

- 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
workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.zip
workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*vendor*.img
name: ${{ github.event.inputs.DEVICE_NAME }}-${{ github.run_id }}
workspace/out/target/product/$DEVICE_NAME/$BUILD_TARGET.img
workspace/out/target/product/$DEVICE_NAME/*.zip
workspace/out/target/product/$DEVICE_NAME/*vendor*.img
name: $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
Manifest: $MANIFEST_BRANCH
Device: $DEVICE_NAME
Target: $BUILD_TARGET.img
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 767fe67

Please sign in to comment.