github: fix build-deb-packages #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Prepare Debian Packaging | |
run: | | |
# Initialize debian directory structure if it doesn't exist | |
if [ ! -d "debian" ]; then | |
dh_make --createorig -y --single --native --packagename xnec2c_1.0 | |
fi | |
# Optionally modify the debian/changelog file if needed | |
echo "xnec2c (1.0) unstable; urgency=low" > debian/changelog | |
echo " * Initial release." >> debian/changelog | |
echo " -- Your Name <youremail@example.com> $(date -R)" >> debian/changelog | |
- 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 |