Skip to content

Commit 2d99b69

Browse files
authored
update
1 parent 2927dac commit 2d99b69

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Compile EE-LogRotate SELinux Policy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'logrotate/selinux-policy/ee-logrotate.te'
9+
- '.github/workflows/compile-selinux-policy.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
compile-policy:
14+
# Sử dụng container Fedora để có sẵn các công cụ SELinux
15+
container: fedora:latest
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Install SELinux build tools
25+
# Cài đặt các gói cần thiết trong container Fedora
26+
run: dnf install -y policycoreutils-devel selinux-policy-devel make
27+
28+
- name: Compile and package SELinux policy
29+
run: |
30+
# Di chuyển vào thư mục chứa file .te
31+
cd logrotate/selinux-policy/
32+
33+
# Bước 1: Biên dịch file .te thành .mod
34+
echo "Compiling ee-logrotate.te to ee-logrotate.mod..."
35+
checkmodule -M -m -o ee-logrotate.mod ee-logrotate.te
36+
37+
# Bước 2: Tạo policy package (.pp) từ file .mod
38+
echo "Creating ee-logrotate.pp from ee-logrotate.mod..."
39+
semodule_package -o ee-logrotate.pp -m ee-logrotate.mod
40+
41+
# Thêm một bước để lấy thông tin tag mới nhất, vì upload release cần tag
42+
- name: Get the latest tag
43+
id: get_tag
44+
run: |
45+
latest_tag=$(git describe --tags --abbrev=0)
46+
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT
47+
echo "📌 Latest tag: ${latest_tag}"
48+
49+
# Thêm bước này để tải file .pp lên GitHub Release
50+
- name: Upload compiled policy file to release
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
# Di chuyển file .pp về thư mục gốc để dễ dàng upload
55+
mv logrotate/selinux-policy/ee-logrotate.pp .
56+
gh release upload ${{ steps.get_tag.outputs.latest_tag }} ee-logrotate.pp --clobber
57+
echo "✅ Successfully uploaded ee-logrotate.pp to release '${{ steps.get_tag.outputs.latest_tag }}'"
58+
59+
# Xóa bước upload artifact cũ
60+
# - name: Upload compiled policy file
61+
# uses: actions/upload-artifact@v4
62+
# with:
63+
# name: compiled-selinux-policy
64+
# path: ee-logrotate.pp
65+
# retention-days: 5
File renamed without changes.

0 commit comments

Comments
 (0)