test-action-debian-package/main.sh

51 lines
973 B
Bash
Raw Normal View History

2020-03-25 22:13:26 +00:00
#!/bin/sh
set -eu
2020-03-25 22:13:26 +00:00
directory="${INPUT_DIRECTORY:-}"
2020-03-25 22:13:26 +00:00
os="${INPUT_OS:-"debian"}"
directory_runner="$RUNNER_WORKSPACE/$directory"
directory_container="$GITHUB_WORKSPACE/$directory"
cd "$directory_container"
2020-03-25 22:13:26 +00:00
package="$(dpkg-parsechangelog -S Source)"
version="$(dpkg-parsechangelog -S Version)"
distribution="$(dpkg-parsechangelog -S Distribution | sed 's/UNRELEASED/unstable/')"
2020-03-25 23:28:59 +00:00
container="$package_$version"
2020-03-25 22:13:26 +00:00
image="$os:$distribution"
docker create \
2020-03-25 23:28:59 +00:00
--tty \
2020-03-25 22:13:26 +00:00
--name "$container" \
--volume "$directory_runner":"$directory_container" \
--workdir "$directory_container" \
2020-03-25 22:13:26 +00:00
"$image" \
sleep inf
2020-03-25 22:34:04 +00:00
docker start \
"$container"
2020-03-25 23:42:28 +00:00
echo
2020-03-25 23:44:45 +00:00
docker exec $container ls -lha
2020-03-25 23:42:28 +00:00
echo
exit
2020-03-25 22:13:26 +00:00
docker exec \
"$container" \
apt-get update
docker exec \
"$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 \
"$container" \
apt-get build-dep "$directory_container"
2020-03-25 22:13:26 +00:00
docker exec \
"$container" \
dpkg-buildpackage -S -us -uc