Skip to content

Build deb package on release #3

Build deb package on release

Build deb package on release #3

Workflow file for this run

name: Build deb package on release
on:
release:
types: [published]
jobs:
build-deb:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential devscripts debhelper fakeroot lintian
- name: Set up Debian packaging
run: |
APP_NAME=libbash.sh
# get release version without the "v"
VERSION="$(echo ${GITHUB_REF##*/} | sed 's/^v//')"
INSTALL_DIR=usr/lib/$APP_NAME
mkdir -p debian/source
# Create control file (adjust fields accordingly)
cat <<EOF > debian/control
Source: $APP_NAME
Section: libs
Priority: optional
Maintainer: Jean Prunneaux <jean@prunneaux.com>
Homepage: https://github.com/${{ github.repository }}
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.5.1
Package: $APP_NAME
Architecture: all
Depends: bash
Description: Library of useful Bash functions.
EOF
# Minimal rules file
cat <<EOF > debian/rules
#!/usr/bin/make -f
%:
dh \$@
EOF
chmod +x debian/rules
# Other required files
echo 1.0 > debian/source/format
# Changelog
dch --create -v "$VERSION" --package libbash.sh "Release $VERSION"
# copy files
find . -maxdepth 1 -mindepth 1 ! -name ".git*" ! -name "debian" ! -name "examples" ! -name "tests" -exec mkdir -p "debian/$APP_NAME/$INSTALL_DIR" \; -exec cp -r {} "debian/$APP_NAME/$INSTALL_DIR/" \;
# empty install file to avoid dh_install warnings
touch debian/install
- name: Build the deb package
run: |
# build without signing
dpkg-buildpackage -us -uc
- name: Upload .deb to release
uses: softprops/action-gh-release@v1
with:
files: ../libbash.sh_*.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}