Skip to content

Commit 1b6f0b2

Browse files
authored
update
1 parent 3da6fe8 commit 1b6f0b2

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

.github/workflows/compile-ee-logrotate-sepolicy.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@ on:
66
- main
77
paths:
88
- 'logrotate/selinux-policy/ee-logrotate.te'
9-
- '.github/workflows/compile-ee-logrotate-sepolicy.yml'
9+
- '.github/workflows/compile-selinux-policy.yml'
1010
workflow_dispatch:
1111

1212
jobs:
1313
compile-policy:
14-
# Sử dụng container Fedora để có sẵn các công cụ SELinux
15-
container: fedora:latest
14+
# Chạy trên máy chủ Ubuntu mặc định, không dùng container
1615
runs-on: ubuntu-latest
1716
permissions:
1817
contents: write
1918

2019
steps:
2120
- name: Checkout repository
21+
# Bước này sẽ tải code về và bao gồm lịch sử Git đầy đủ
2222
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
2325

2426
- name: Install SELinux build tools and Git
25-
# Cài đặt các gói cần thiết và cả git trong container Fedora
26-
run: dnf install -y policycoreutils-devel selinux-policy-devel make git
27+
# Cài đặt các gói cần thiết bằng apt-get trên Ubuntu
28+
run: sudo apt-get update && sudo apt-get install -y policycoreutils selinux-policy-dev make git
2729

2830
- name: Compile and package SELinux policy
2931
run: |
@@ -32,36 +34,24 @@ jobs:
3234
3335
# Bước 1: Biên dịch file .te thành .mod
3436
echo "Compiling ee-logrotate.te to ee-logrotate.mod..."
35-
# Đổi tên file đầu ra để khớp với tên module bên trong file .te
3637
checkmodule -M -m -o ee-logrotate.mod ee-logrotate.te
3738
3839
# Bước 2: Tạo policy package (.pp) từ file .mod
3940
echo "Creating ee-logrotate.pp from ee-logrotate.mod..."
4041
semodule_package -o ee-logrotate.pp -m ee-logrotate.mod
4142
42-
# Thêm một bước để lấy thông tin tag mới nhất, vì upload release cần tag
4343
- name: Get the latest tag
4444
id: get_tag
4545
run: |
4646
latest_tag=$(git describe --tags --abbrev=0)
4747
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT
4848
echo "📌 Latest tag: ${latest_tag}"
4949
50-
# Thêm bước này để tải file .pp lên GitHub Release
5150
- name: Upload compiled policy file to release
5251
env:
5352
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5453
run: |
5554
# Di chuyển file .pp về thư mục gốc để dễ dàng upload
5655
mv logrotate/selinux-policy/ee-logrotate.pp .
57-
# Đổi tên file để tải lên khớp với tên mới
5856
gh release upload ${{ steps.get_tag.outputs.latest_tag }} ee-logrotate.pp --clobber
5957
echo "✅ Successfully uploaded ee-logrotate.pp to release '${{ steps.get_tag.outputs.latest_tag }}'"
60-
61-
# Xóa bước upload artifact cũ
62-
# - name: Upload compiled policy file
63-
# uses: actions/upload-artifact@v4
64-
# with:
65-
# name: compiled-selinux-policy
66-
# path: ee-logrotate.pp
67-
# retention-days: 5

0 commit comments

Comments
 (0)