Skip to content

Add CI workflows for DEB, RPM, and AppImage builds #25

Add CI workflows for DEB, RPM, and AppImage builds

Add CI workflows for DEB, RPM, and AppImage builds #25

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
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "DIST=$DIST" >> $GITHUB_ENV
- name: Generate Debian Packaging Files
run: |
if [ ! -d "debian" ]; then
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 "xnec2c ($VERSION) unstable; urgency=low\n\n * Initial release.\n\n -- Your Name <you@example.com> $(date -R)" > debian/changelog
cat > debian/control <<EOL
Source: xnec2c
Section: utils
Priority: optional
Maintainer: Your Name <you@example.com>
Build-Depends: debhelper (>= 9), autotools-dev, automake, autoconf, libtool, libgtk-3-dev, libglib2.0-dev, gettext, desktop-file-utils
Standards-Version: 3.9.6
Homepage: https://www.example.com
Package: xnec2c
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: A multi-threaded EM tool to model antenna near- and far-field radiation patterns.
Xnec2c is a high-performance multi-threaded electromagnetic simulation
package to model antenna near- and far-field radiation patterns for
Linux and UNIX operating systems.
EOL

Check failure on line 73 in .github/workflows/build-deb-packages.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-deb-packages.yml

Invalid workflow file

You have an error in your yaml syntax on line 73
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