Skip to content

Commit ce210de

Browse files
authored
Update build-kernel.yml
1 parent f0c257d commit ce210de

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

.github/workflows/build-kernel.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Build GKI Kernels With KernelSU-Next & SUSFS
22

33
on:
4+
push:
5+
branches:
6+
- main # Trigger only on pushes to the main branch
47
workflow_dispatch:
58
inputs:
69
lto_type:
@@ -13,33 +16,35 @@ on:
1316
- full
1417
build_android_12:
1518
description: 'Build Android 12 GKI Kernel?'
16-
required: false
17-
default: true
19+
required: false # Optional for manual trigger
20+
default: true # Defaults to building Android 12
1821
type: boolean
1922
build_android_13:
2023
description: 'Build Android 13 GKI Kernel?'
21-
required: false
22-
default: true
24+
required: false # Optional for manual trigger
25+
default: true # Defaults to building Android 13
2326
type: boolean
2427
build_android_14:
2528
description: 'Build Android 14 GKI Kernel?'
26-
required: false
27-
default: true
29+
required: false # Optional for manual trigger
30+
default: true # Defaults to building Android 14
2831
type: boolean
2932
make_release:
3033
description: 'Trigger release after the build?'
31-
required: false
32-
default: true
34+
required: false # Optional for manual trigger
35+
default: false # Defaults to not triggering a release
3336
type: boolean
3437

3538
jobs:
3639
# Validation Step
3740
validate-inputs:
3841
runs-on: ubuntu-latest
42+
if: ${{ github.event_name == 'workflow_dispatch' }} # Only for manual trigger
3943
outputs:
4044
build_a12: ${{ inputs.build_android_12 }}
4145
build_a13: ${{ inputs.build_android_13 }}
4246
build_a14: ${{ inputs.build_android_14 }}
47+
make_release: ${{ inputs.make_release }}
4348
steps:
4449
- name: Validate Inputs
4550
run: |
@@ -55,43 +60,43 @@ jobs:
5560
echo "build_a12=${{ inputs.build_android_12 }}" >> $GITHUB_ENV
5661
echo "build_a13=${{ inputs.build_android_13 }}" >> $GITHUB_ENV
5762
echo "build_a14=${{ inputs.build_android_14 }}" >> $GITHUB_ENV
63+
echo "make_release=${{ inputs.make_release }}" >> $GITHUB_ENV
5864
5965
# Build Android 12 GKI Kernel
6066
build-kernel-a12:
61-
if: ${{ env.build_a12 == 'true' }}
67+
if: github.event_name == 'push' || env.build_a12 == 'true'
6268
needs: validate-inputs
6369
uses: ./.github/workflows/build-kernel-a12.yml
6470
with:
65-
lto_type: ${{ inputs.lto_type }}
71+
lto_type: ${{ inputs.lto_type || 'full' }} # Default to full LTO for push
6672
secrets: inherit
6773

6874
# Build Android 13 GKI Kernel
6975
build-kernel-a13:
70-
if: ${{ env.build_a13 == 'true' }}
76+
if: github.event_name == 'push' || env.build_a13 == 'true'
7177
needs: validate-inputs
7278
uses: ./.github/workflows/build-kernel-a13.yml
7379
with:
74-
lto_type: ${{ inputs.lto_type }}
80+
lto_type: ${{ inputs.lto_type || 'full' }} # Default to full LTO for push
7581
secrets: inherit
7682

7783
# Build Android 14 GKI Kernel
7884
build-kernel-a14:
79-
if: ${{ env.build_a14 == 'true' }}
85+
if: github.event_name == 'push' || env.build_a14 == 'true'
8086
needs: validate-inputs
8187
uses: ./.github/workflows/build-kernel-a14.yml
8288
with:
83-
lto_type: ${{ inputs.lto_type }}
89+
lto_type: ${{ inputs.lto_type || 'full' }} # Default to full LTO for push
8490
secrets: inherit
8591

8692
# Trigger Release Job
8793
trigger-release:
8894
runs-on: ubuntu-latest
8995
needs:
90-
- validate-inputs
9196
- build-kernel-a12
9297
- build-kernel-a13
9398
- build-kernel-a14
94-
if: ${{ env.build_a12 == 'true' || env.build_a13 == 'true' || env.build_a14 == 'true' && inputs.make_release == 'true' }}
99+
if: github.event_name == 'push' || (env.make_release == 'true' && (env.build_a12 == 'true' || env.build_a13 == 'true' || env.build_a14 == 'true'))
95100
steps:
96101
- name: Checkout code
97102
uses: actions/checkout@v2

0 commit comments

Comments
 (0)