-
Notifications
You must be signed in to change notification settings - Fork 2
148 lines (126 loc) · 5.02 KB
/
build-deb.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
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
145
146
147
148
name: Build and test deb package for linupdate
on:
push:
branches: [ devel ]
pull_request:
push:
branches: [ main ]
jobs:
build-deb:
name: Build deb package
runs-on: ubuntu-latest
container:
image: debian:latest
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
- name: Install dependencies packages
run: apt-get update && apt-get install build-essential binutils lintian debhelper dh-make devscripts -y
- name: Create build environment
run: |
mkdir -p /tmp/linupdate-build/DEBIAN
mkdir -p /tmp/linupdate-build/etc/linupdate/modules
mkdir -p /tmp/linupdate-build/opt/linupdate
mkdir -p /tmp/linupdate-build/opt/linupdate/.src/
mkdir -p /tmp/linupdate-build/opt/linupdate/mods-available/
mkdir -p /tmp/linupdate-build/opt/linupdate/mods-enabled/
mkdir -p /tmp/linupdate-build/opt/linupdate/agents-available/
mkdir -p /tmp/linupdate-build/opt/linupdate/service/
mkdir -p /tmp/linupdate-build/lib/systemd/system/
- name: Copy files to include in the build
run: |
cp -r ${GITHUB_WORKSPACE}/src/* /tmp/linupdate-build/opt/linupdate/.src/
cp -r ${GITHUB_WORKSPACE}/mods-available/* /tmp/linupdate-build/opt/linupdate/mods-available/
cp -r ${GITHUB_WORKSPACE}/service/* /tmp/linupdate-build/opt/linupdate/service/
cp ${GITHUB_WORKSPACE}/linupdate /tmp/linupdate-build/opt/linupdate/linupdate
cp ${GITHUB_WORKSPACE}/version /tmp/linupdate-build/opt/linupdate/version
cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /tmp/linupdate-build/lib/systemd/system/linupdate.service
- name: Copy control file
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/control /tmp/linupdate-build/DEBIAN/control
sed -i "s/__VERSION__/${{ env.VERSION }}/g" /tmp/linupdate-build/DEBIAN/control
- name: Copy preinst and postinst script
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/preinst /tmp/linupdate-build/DEBIAN/preinst
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/postinst /tmp/linupdate-build/DEBIAN/postinst
chmod 755 /tmp/linupdate-build/DEBIAN/preinst /tmp/linupdate-build/DEBIAN/postinst
- name: Build package
run: |
cd /tmp
dpkg-deb --build linupdate-build
mv /tmp/linupdate-build.deb /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
path: /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb
retention-days: 1
# Try to install package on Debian 10
install-debian-10:
name: Install on Debian 10
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:10
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Install package
run: |
apt-get update -y
apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
# Try to install package on Debian 11
install-debian-11:
name: Install on Debian 11
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:11
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Install package
run: |
apt-get update -y
apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
# Try to install package on Ubuntu (latest)
install-ubuntu:
name: Install on Ubuntu (latest)
needs:
build-deb
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Install package
run: |
sudo apt-get update -y
sudo apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb