-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (81 loc) · 2.87 KB
/
Copy pathbuild-linux.yml
File metadata and controls
102 lines (81 loc) · 2.87 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
name: Build Linux
on:
workflow_call:
inputs:
version:
required: true
type: string
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y lazarus fpc dpkg-dev rpm binutils
- name: Build binary
run: make
- name: Package deb
run: |
template_root="installer/linux"
work_root="dist/debwork"
pkg_name="pobatch-${VERSION}.deb"
if [ ! -d "$template_root" ]; then
echo "Debian template not found at $template_root"
exit 1
fi
rm -rf "$work_root"
mkdir -p "$work_root/control" "$work_root/data" dist
if [ -d "$template_root/CONTROL" ]; then
rsync -a "$template_root/CONTROL/" "$work_root/control/"
fi
if [ -d "$template_root/DATA" ]; then
rsync -a "$template_root/DATA/" "$work_root/data/"
fi
install -d "$work_root/data/usr/bin"
install -m 0755 pobatch "$work_root/data/usr/bin/pobatch"
sed -i "s/^Version:.*/Version: ${VERSION}/" "$work_root/control/control"
tar -C "$work_root/control" -czf "$work_root/control.tar.gz" .
tar -C "$work_root/data" -czf "$work_root/data.tar.gz" .
printf '2.0\n' > "$work_root/debian-binary"
ar r "dist/$pkg_name" \
"$work_root/debian-binary" \
"$work_root/control.tar.gz" \
"$work_root/data.tar.gz"
- name: Package rpm
run: |
template_root="installer/linux"
rpm_root="dist/rpm"
staging_root="$rpm_root/staging"
sources_root="$rpm_root/SOURCES"
if [ ! -d "$template_root" ]; then
echo "RPM template not found at $template_root"
exit 1
fi
rm -rf "$rpm_root"
mkdir -p "$staging_root" "$sources_root"
if [ -d "$template_root/DATA" ]; then
rsync -a "$template_root/DATA/" "$staging_root/"
fi
install -d "$staging_root/usr/bin"
install -m 0755 pobatch "$staging_root/usr/bin/pobatch"
find "$staging_root" -type f -o -type l | sed "s|^$staging_root||" | sed 's|^|/|' > "$sources_root/pobatch.files"
rpmbuild -bb "installer/linux/pobatch.spec" \
--define "_topdir $PWD/$rpm_root" \
--define "version $VERSION" \
--define "staging_dir $PWD/$staging_root"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-linux-artifacts
path: |
dist/*.deb
dist/rpm/RPMS/**/*.rpm