Skip to content

Commit 56b71f6

Browse files
committed
feat: release workflow
1 parent 12076d3 commit 56b71f6

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/build.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
build-deb:
11+
runs-on: ubuntu-24.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Install dependencies
15+
run: sudo apt-get install -y build-essential dpkg-dev
16+
- name: Download source deb
17+
run: |
18+
branch=$(echo $GITHUB_REF | cut -d'/' -f3)
19+
branch=${branch/-p2p/}
20+
version=$(echo $branch | cut -d'.' -f1)
21+
# download source deb
22+
echo "Downloading nvidia-kernel-source-${version}-open_${branch}-0ubuntu1_amd64.deb"
23+
curl -o source.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/nvidia-kernel-source-${version}-open_${branch}-0ubuntu1_amd64.deb
24+
- name: Extract source deb
25+
run: dpkg-deb -R source.deb source-deb
26+
- name: Build kernel module
27+
run: |
28+
make modules -j$(nproc)
29+
- name: Replace kernel module source
30+
run: |
31+
branch=$(echo $GITHUB_REF | cut -d'/' -f3)
32+
branch=${branch/-p2p/}
33+
rm -r source-deb/usr/src/nvidia-${branch}/
34+
cp -r kernel-open/ source-deb/usr/src/nvidia-${branch}/
35+
rm source-deb/usr/src/nvidia-${branch}/dkms.conf
36+
- name: Replace kernel module
37+
run: |
38+
branch=$(echo $GITHUB_REF | cut -d'/' -f3)
39+
branch=${branch/-p2p/}
40+
rm source-deb/usr/src/nvidia-${branch}/nvidia/nv-kernel.o_binary
41+
rm source-deb/usr/src/nvidia-${branch}/nvidia-modeset/nv-modeset-kernel.o_binary
42+
cp src/nvidia/_out/Linux_x86_64/nv-kernel.o source-deb/usr/src/nvidia-${branch}/nvidia/nv-kernel.o_binary
43+
cp src/nvidia-modeset/_out/Linux_x86_64/nv-modeset-kernel.o source-deb/usr/src/nvidia-${branch}/nvidia-modeset/nv-modeset-kernel.o_binary
44+
- name: Repack deb
45+
run: |
46+
branch=$(echo $GITHUB_REF | cut -d'/' -f3)
47+
branch=${branch/-p2p/}
48+
version=$(echo $branch | cut -d'.' -f1)
49+
dpkg-deb -b source-deb nvidia-kernel-source-${version}-open-0ubuntu1_amd64.deb
50+
- name: Generate artifact name
51+
run: |
52+
branch=$(echo $GITHUB_REF | cut -d'/' -f3)
53+
branch=${branch/-p2p/}
54+
version=$(echo $branch | cut -d'.' -f1)
55+
echo "artifact_name=nvidia-kernel-source-${version}-open-0ubuntu1_amd64.deb" >> $GITHUB_ENV
56+
- name: Upload deb
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: ${{ env.artifact_name }}
60+
path: ${{ env.artifact_name }}
61+
- name: Create release
62+
uses: softprops/action-gh-release@v2
63+
if: github.ref_type == 'tag'
64+
with:
65+
files: ${{ env.artifact_name }}
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)