-
Notifications
You must be signed in to change notification settings - Fork 30
95 lines (81 loc) · 3.04 KB
/
build-kpm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build CI
on:
push:
paths:
- ".github/workflows/build-kpm.yml"
- "kernel/**"
- "src/**"
workflow_dispatch:
inputs:
release:
description: 'Push a new release'
required: false
default: 'false'
version:
description: 'release version'
required: false
default: '23040200'
jobs:
Build-on-Ubuntu:
runs-on: ubuntu-latest
permissions:
contents: write
env:
TZ: UTC-8
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
- name: Update system and install dependencies
run: |
sudo apt update -y
sudo apt install llvm -y
- name: Build kpm
run: |
mkdir target
make -C src/hosts_file_redirect
mv src/hosts_file_redirect/*.kpm target
make -C src/selinux_policydb_fix
mv src/selinux_policydb_fix/*.kpm target
make -C src/critical_partition_protect
mv src/critical_partition_protect/*.kpm target
- name: Prepare artifact
if: success()
id: Artifact
run: |
hosts_file_redirect_name=`ls -d target/hosts_file_redirect*.kpm | awk -F '(/|.kpm)' '{print $2}'` && echo "hosts_file_redirect_name=$hosts_file_redirect_name" >> $GITHUB_OUTPUT
selinux_policydb_fix=`ls -d target/selinux_policydb_fix*.kpm | awk -F '(/|.kpm)' '{print $2}'` && echo "selinux_policydb_fix=$selinux_policydb_fix" >> $GITHUB_OUTPUT
critical_partition_protect=`ls -d target/critical_partition_protect*.kpm | awk -F '(/|.kpm)' '{print $2}'` && echo "critical_partition_protect=$critical_partition_protect" >> $GITHUB_OUTPUT
- name: Upload hosts_file_redirect
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ steps.Artifact.outputs.hosts_file_redirect_name }}
path: 'target/${{ steps.Artifact.outputs.hosts_file_redirect_name }}*'
- name: Upload selinux_policydb_fix
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ steps.Artifact.outputs.selinux_policydb_fix }}
path: 'target/${{ steps.Artifact.outputs.selinux_policydb_fix }}*'
- name: Upload critical_partition_protect
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ steps.Artifact.outputs.critical_partition_protect }}
path: 'target/${{ steps.Artifact.outputs.critical_partition_protect }}*'
- name: Upload release
if: github.event.inputs.release == 'true' && success() && !cancelled()
uses: ncipollo/release-action@v1.14.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.event.inputs.version }}
tag: ${{ github.event.inputs.version }}
body: This release is built by github-action.
artifacts: "target/*.kpm"
allowUpdates: true
makeLatest: true
omitBodyDuringUpdate: true
replacesArtifacts: true