-
Notifications
You must be signed in to change notification settings - Fork 18
119 lines (104 loc) · 4.13 KB
/
build-deb-packages.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
name: Build DEB Packages
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-20.04
- ubuntu-18.04
- debian-11
- debian-10
- debian-9
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch full Git history and tags
- name: Set up the build environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf automake libtool \
libgtk-3-dev libglib2.0-dev gettext desktop-file-utils devscripts fakeroot lintian autopoint dh-make dh-autoreconf
- name: Determine version and dist
id: version
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
TAGGED_COMMIT=$(git describe --tags --exact-match 2>/dev/null || echo "notag")
if [ "$TAGGED_COMMIT" = "notag" ]; then
VERSION="${LATEST_TAG}+"
DIST="-git"
else
VERSION=$LATEST_TAG
DIST=""
fi
# Remove the 'v' prefix and ensure the version starts with a digit
VERSION=$(echo $VERSION | sed 's/^v//')
VERSION=$(echo $VERSION | sed 's/[+]//g') # Replace '+' with '.'
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "DIST=$DIST" >> $GITHUB_ENV
- name: Generate Debian Packaging Files
run: |
rm -rf ./debian
dh_make --createorig -y --single --native --packagename xnec2c_$VERSION
echo -e '#!/usr/bin/make -f\n%:\n\tdh $@' > debian/rules
chmod +x debian/rules
echo "9" > debian/compat
echo "Source: xnec2c" > debian/control
echo "Section: utils" >> debian/control
echo "Priority: optional" >> debian/control
echo "Maintainer: Your Name <you@example.com>" >> debian/control
echo "Build-Depends: debhelper (>= 9), autotools-dev, automake, autoconf, libtool, libgtk-3-dev, libglib2.0-dev, gettext, desktop-file-utils" >> debian/control
echo "Standards-Version: 3.9.6" >> debian/control
echo "Homepage: https://www.example.com" >> debian/control
echo "" >> debian/control
echo "Package: xnec2c" >> debian/control
echo "Architecture: any" >> debian/control
echo "Depends: \${shlibs:Depends}, \${misc:Depends}" >> debian/control
echo "Description: A multi-threaded EM tool to model antenna near- and far-field radiation patterns." >> debian/control
echo " Xnec2c is a high-performance multi-threaded electromagnetic simulation" >> debian/control
echo " package to model antenna near- and far-field radiation patterns for" >> debian/control
echo " Linux and UNIX operating systems." >> debian/control
- name: Generate Debian Changelog from Git Log
run: |
VERSION=${{ steps.version.outputs.VERSION }}${{ steps.version.outputs.DIST }}
PACKAGE_NAME="xnec2c"
DISTRIBUTION="unstable"
MAINTAINER="Your Name <you@example.com>"
echo "$PACKAGE_NAME ($VERSION) $DISTRIBUTION; urgency=low" > debian/changelog
echo "" >> debian/changelog
git log --pretty=format:" * %s" >> debian/changelog
echo "" >> debian/changelog
echo " -- $MAINTAINER $(date -R)" >> debian/changelog
- name: Verify Debian Directory
run: |
if [ ! -f "debian/rules" ]; then
echo "Error: debian/rules file not found!"
exit 1
fi
- name: Build the DEB package using debuild
run: |
./autogen.sh
./configure
make
debuild -us -uc -b
- name: Test DEB package
run: |
dpkg -i ../xnec2c_*.deb || true
xnec2c -h
- name: Upload the DEB package
uses: actions/upload-artifact@v2
with:
name: xnec2c-${{ matrix.os }}.deb
path: ../xnec2c_*.deb