Repository navigation
144 lines (129 loc) · 5.98 KB
/
Copy pathtest.yml
File metadata and controls
144 lines (129 loc) · 5.98 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# Description: Build Kernel using GitHub Actions
# Change from P3TERX
#
name: test
on:
workflow_dispatch:
#schedule:
#- cron: "36 20 * * 1,4"
# inputs:
# ssh:
# description: 'SSH connection to Actions'
# required: false
# default: 'false'
env:
UPLOAD_DIR: true
UPLOAD_RELEASE: true
UPLOAD_WETRANSFER: false
WEBSSH: false
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-latest
container: docker.io/qctt/kernelbuild:ubuntu20.04
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt update
apt-get install libfuse-dev libarchive-dev xfsprogs jq -y
#apt-get install btrfs-tools -y
apt install btrfs-progs pip python -y
pip install yamlish junit_xml
#mkdir /github
#mkdir /github/home/
mkdir /github/home/.ssh/
sudo chown $USER:$GROUPS /workdir
sudo chown $USER:$GROUPS /workdir/upload
- name: Check for updates
id: check
run: |
github_tag=$(curl -s 'https://api.github.com/repos/ylx2016/kernel/releases' | grep 'Centos_Kernel' | grep '_lts_latest_' | grep 'xanmod' | head -n 1 | awk -F '"' '{print $4}' | awk -F '[/]' '{print $8}')
github_ver=$(curl -s 'https://api.github.com/repos/ylx2016/kernel/releases' | grep ${github_tag} | grep 'rpm' | grep 'headers' | awk -F '"' '{print $4}' | awk -F '[/]' '{print $9}' | awk -F '[-]' '{print $3}' | awk -F '[_]' '{print $1}')
kernel_ver=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}' | awk -F '[-]' '{print $1}')
echo "github_ver=" $github_ver
echo "kernel_ver=" $kernel_ver
if [[ $github_ver == *"$kernel_ver"* ]]; then
echo "::set-output name=status::fail"
else
echo "::set-output name=status::success"
fi
- name: Get source code
id: code
#if: steps.check.outputs.status == 'success' && (!cancelled())
working-directory: /workdir
run: |
df -hT $PWD
xanmod_lts=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}')
xanmod_lts_ver=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}' | awk -F '[-]' '{print $1}')
kernel_file=https://github.com/xanmod/linux/archive/refs/tags/$xanmod_lts.zip
wget $kernel_file && unzip $xanmod_lts.zip -d /workdir
echo "::set-output name=status::success"
- name: SSH connection to Actions
uses: P3TERX/ssh2actions@v1.0.0
if: env.WEBSSH == 'true'
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: Compile the kernel
id: compile
if: steps.code.outputs.status == 'success'
working-directory: /workdir
run: |
xanmod_lts_ver=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}' | awk -F '[-]' '{print $1}')
xanmod_lts=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}')
cd linux-$xanmod_lts
if [ -f "CONFIGS/xanmod/gcc/config" ]; then
cp CONFIGS/xanmod/gcc/config .config
fi
sed -ri '/CONFIG_SYSTEM_TRUSTED_KEYS/s/=.+/=""/g' .config && scripts/config --disable MODULE_SIG && scripts/config --disable DEBUG_INFO
sed -ri '/CONFIG_TLS/s/=.+/=y/g' .config
sed -ri '/CONFIG_TLS_DEVICE/s/=.+/=y/g' .config
sed -ri '/CONFIG_MPTCP*/c\CONFIG_MPTCP=m' .config
echo -e "$(nproc) thread compile"
sudo time make -j$(nproc) deb-pkg
cd /workdir && mv *.deb /workdir/upload
echo "::set-output name=status::success"
echo "FILE_DATE=Kernel_Ubuntu_${xanmod_lts}_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: Check space usage
if: (!cancelled()) && steps.compile.outputs.status == 'success'
run: df -hT
- name: Upload
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_DIR == 'true'
with:
name: ${{ env.FILE_DATE }}
path: /workdir/upload
- name: Upload to WeTransfer
id: wetransfer
if: steps.compile.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress /workdir/upload 2>&1 | tee wetransfer.log
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"
echo "::set-output name=url::$(cat wetransfer.log | grep https | cut -f3 -d" ")"
- name: Generate release tag
id: tag
if: env.UPLOAD_RELEASE == 'true' && steps.compile.outputs.status == 'success' && !cancelled()
run: |
xanmod_lts_ver=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}' | awk -F '[-]' '{print $1}')
xanmod_lts=$(curl -s https://sourceforge.net/projects/xanmod/files/releases/lts/ | grep 'class="folder ">' | head -n 1 | awk -F '"' '{print $2}')
echo "::set-output name=release_tag::Ubuntu_Kernel_${xanmod_lts}_lts_latest_$(date +"%Y.%m.%d-%H%M")"
touch release.txt
echo "::set-output name=status::success"
- name: Upload kernel to release
uses: softprops/action-gh-release@v1
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
body_path: release.txt
files: /workdir/upload/*