test-action-debian-package/main.sh

61 lines
1.2 KiB
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"}"
2020-03-26 00:25:50 +00:00
directory_runner="$RUNNER_WORKSPACE/$(echo $GITHUB_REPOSITORY | cut -d/ -f2)/$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-26 00:00:26 +00:00
container="$package-$version"
2020-03-25 22:13:26 +00:00
image="$os:$distribution"
2020-03-26 00:08:24 +00:00
cat <<EOF
directory_runner=$directory_runner
directory_container=$directory_container
EOF
2020-03-25 22:13:26 +00:00
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-26 00:08:24 +00:00
echo -----------
pwd
ls -lh
echo -----------
echo -----------
docker exec "$container" pwd
docker exec "$container" ls -lh
echo -----------
2020-03-25 23:42:28 +00:00
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