Skip to content

github: fix build-deb-packages #9

github: fix build-deb-packages

github: fix build-deb-packages #9

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
- 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
- name: Determine version and dist
id: version
run: |
# Get the most recent tag, and check if the latest commit is tagged
LATEST_TAG=$(git describe --tags --abbrev=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: Prepare Debian Packaging
run: |
# Initialize debian directory structure with the correct version if it doesn't exist
if [ ! -d "debian" ]; then
dh_make --createorig -y --single --native --packagename xnec2c_$VERSION
fi
# Ensure the debian/rules file exists and is executable
chmod +x debian/rules
- 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 # Install DEB package
xnec2c -h # Run test
- name: Upload the DEB package
uses: actions/upload-artifact@v2
with:
name: xnec2c-${{ matrix.os }}.deb
path: ../xnec2c_*.deb