feat: add pre_package_hook input

This commit is contained in:
s3lph 2023-12-19 04:59:08 +01:00
parent 6c2097d919
commit 8a5076c570
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5

View file

@ -18,6 +18,9 @@ inputs:
architecture: architecture:
description: Architecture for which this package is built. Only relevant for the resulting filename. description: Architecture for which this package is built. Only relevant for the resulting filename.
default: all default: all
pre_package_hook:
description: Shell script to run right before invoking "dpkg-deb --build".
default: ""
runs: runs:
using: docker using: docker
image: docker://docker.io/library/debian:bookworm image: docker://docker.io/library/debian:bookworm
@ -50,6 +53,7 @@ runs:
[[ -f ${{ inputs.package_root }}/DEBIAN/prerm ]] && chmod +x ${{ inputs.package_root }}/DEBIAN/prerm [[ -f ${{ inputs.package_root }}/DEBIAN/prerm ]] && chmod +x ${{ inputs.package_root }}/DEBIAN/prerm
[[ -f ${{ inputs.package_root }}/DEBIAN/postrm ]] && chmod +x ${{ inputs.package_root }}/DEBIAN/postrm [[ -f ${{ inputs.package_root }}/DEBIAN/postrm ]] && chmod +x ${{ inputs.package_root }}/DEBIAN/postrm
sed -re "s/__VERSION__/${VERSION}-1/g" -i ${{ inputs.package_root }}/DEBIAN/control sed -re "s/__VERSION__/${VERSION}-1/g" -i ${{ inputs.package_root }}/DEBIAN/control
${{ inputs.pre_package_hook }}
cd "${{ inputs.package_root }}/.." cd "${{ inputs.package_root }}/.."
dpkg-deb --build $(basename ${{ inputs.package_root }}) dpkg-deb --build $(basename ${{ inputs.package_root }})
mv "$(basename ${{ inputs.package_root }}).deb" "${GITHUB_WORKSPACE}/${{ inputs.package_output_path }}/${{ inputs.package_name }}_${VERSION}-1_${{ inputs.architecture }}.deb" mv "$(basename ${{ inputs.package_root }}).deb" "${GITHUB_WORKSPACE}/${{ inputs.package_output_path }}/${{ inputs.package_name }}_${VERSION}-1_${{ inputs.architecture }}.deb"