test-action-debian-package/main.sh

49 lines
872 B
Bash
Raw Normal View History

2020-03-25 22:13:26 +00:00
#!/bin/sh
set -e
directory="${INPUT_DIRECTORY:-$PWD}"
os="${INPUT_OS:-"debian"}"
cd "$directory"
package="$(dpkg-parsechangelog -S Source)"
version="$(dpkg-parsechangelog -S Version)"
distribution="$(dpkg-parsechangelog -S Distribution | sed 's/UNRELEASED/unstable/')"
container="builder"
image="$os:$distribution"
workdir="/build/source"
docker create \
--name "$container" \
--volume "$directory":"$workdir" \
--workdir "$workdir" \
"$image" \
sleep inf
2020-03-25 22:34:04 +00:00
docker start \
"$container"
2020-03-25 22:13:26 +00:00
docker exec \
--tty \
"$container" \
apt-get update
docker exec \
--tty \
"$container" \
2020-03-25 23:16:55 +00:00
apt-get install -y dpkg-dev debhelper
2020-03-25 22:13:26 +00:00
docker exec \
--tty \
--workdir "$workdir" \
"$container" \
apt-get build-dep ./
docker exec \
--tty \
--workdir "$workdir" \
"$container" \
dpkg-buildpackage -S -us -uc