Skip to content

Commit

Permalink
Extend Debian build workflow with configuration options.
Browse files Browse the repository at this point in the history
  * Add optional input configs:
    - DEB_BUILD_OPTIONS
    - INSTALL_DEPENDENCIES
    - VERSION_OVERRIDE
  • Loading branch information
s3rj1k committed Feb 13, 2024
1 parent 2242d73 commit 70f642b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci-deb-packages-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ on:
description: Default OS/Arch
default: linux/amd64
type: string
INSTALL_DEPENDENCIES:
required: false
type: boolean
default: false
description: Install build dependencies from `debian/control`
DEB_BUILD_OPTIONS:
required: false
type: string
default: ''
description: Set DEB_BUILD_OPTIONS variable
VERSION_OVERRIDE:
required: false
type: string
default: ''
description: Override Version variable from `dpkg-parsechangelog --show-field Version`
USE_CMAKE:
required: false
type: boolean
Expand Down Expand Up @@ -66,6 +81,10 @@ jobs:
- name: Generate DEBs based on ${{ inputs.BASE_IMAGE }}:${{ inputs.DISTRO_CODENAME }} for ${{ inputs.PLATFORM }}
if: ${{ inputs.USE_CMAKE == false }}
shell: sh
env:
INSTALL_DEPENDENCIES: ${{ inputs.INSTALL_DEPENDENCIES }}
DEB_BUILD_OPTIONS_CONFIG: ${{ inputs.DEB_BUILD_OPTIONS }}
VERSION_OVERRIDE: ${{ inputs.VERSION_OVERRIDE }}
run: |
mkdir -v -p /tmp/$GITHUB_RUN_ID/
Expand All @@ -83,6 +102,11 @@ jobs:
exit 1
fi
if [ -n "${VERSION_OVERRIDE}" ]; then
version=${VERSION_OVERRIDE}
echo "Overriding Version value to: \${version}"
fi
lsb=\$(lsb_release -cs)
if [ $? -ne 0 ]; then
exit 1
Expand All @@ -91,6 +115,12 @@ jobs:
# eval inside runner
hash=$(echo $GITHUB_SHA | cut -c1-10)
if [ "${INSTALL_DEPENDENCIES}" = "true" ]; then
apt-get -q update && \
mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \
apt-get -y -f install
fi
# deb package version
dch_version=\${version}-${GITHUB_RUN_ID}-\${hash}~\${lsb}
echo "dch_version: \${dch_version}"
Expand All @@ -100,6 +130,12 @@ jobs:
exit 1
fi
if [ -n "${DEB_BUILD_OPTIONS_CONFIG}" ]; then
export DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_CONFIG}"
echo "Environment value of DEB_BUILD_OPTIONS is set to:"
printenv DEB_BUILD_OPTIONS
fi
debuild -b -us -uc && mv -v ../*.deb .
EOF
Expand Down

0 comments on commit 70f642b

Please sign in to comment.