-
Notifications
You must be signed in to change notification settings - Fork 2
234 lines (204 loc) · 8.92 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Build and test deb package for linupdate
on:
push:
branches: [ linupdate-2.x.x ]
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
with:
ref: 'linupdate-2.x.x'
- 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
with:
ref: 'linupdate-2.x.x'
- 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
# - name: Test some params
# run: |
# /opt/linupdate/linupdate --help
# /opt/linupdate/linupdate --version
# /opt/linupdate/linupdate --check-updates
# /opt/linupdate/linupdate --profile container
# /opt/linupdate/linupdate --env test
# /opt/linupdate/linupdate --mod-enable reposerver
# /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3
# /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
# /opt/linupdate/linupdate --mod-configure reposerver --send-full-status
# /opt/linupdate/linupdate --mod-configure reposerver --unregister
# 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
with:
ref: 'linupdate-2.x.x'
- 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
# - name: Test some params
# run: |
# /opt/linupdate/linupdate --help
# /opt/linupdate/linupdate --version
# /opt/linupdate/linupdate --check-updates
# /opt/linupdate/linupdate --profile container
# /opt/linupdate/linupdate --env test
# /opt/linupdate/linupdate --mod-enable reposerver
# /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3
# /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
# /opt/linupdate/linupdate --mod-configure reposerver --send-full-status
# /opt/linupdate/linupdate --mod-configure reposerver --unregister
# Try to install package on Debian 12
install-debian-12:
name: Install on Debian 12
needs:
build-deb
runs-on: ubuntu-latest
container:
image: debian:12
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'linupdate-2.x.x'
- 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
# - name: Test some params
# run: |
# /opt/linupdate/linupdate --help
# /opt/linupdate/linupdate --version
# /opt/linupdate/linupdate --check-updates
# /opt/linupdate/linupdate --profile container
# /opt/linupdate/linupdate --env test
# /opt/linupdate/linupdate --mod-enable reposerver
# /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3
# /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
# /opt/linupdate/linupdate --mod-configure reposerver --send-full-status
# /opt/linupdate/linupdate --mod-configure reposerver --unregister
# 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
with:
ref: 'linupdate-2.x.x'
- 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
# - name: Test some params
# run: |
# sudo /opt/linupdate/linupdate --help
# sudo /opt/linupdate/linupdate --version
# sudo /opt/linupdate/linupdate --check-updates
# sudo /opt/linupdate/linupdate --profile container
# sudo /opt/linupdate/linupdate --env test
# sudo /opt/linupdate/linupdate --mod-enable reposerver
# sudo /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3
# sudo /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
# sudo /opt/linupdate/linupdate --mod-configure reposerver --send-full-status
# sudo /opt/linupdate/linupdate --mod-configure reposerver --unregister