-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.sh
executable file
·87 lines (65 loc) · 2.41 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
set -e
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update &&
sudo apt-get install -y gpg debmake debhelper devscripts equivs \
distro-info-data distro-info software-properties-common
echo "::group::Importing GPG private key..."
echo "Importing GPG private key..."
GPG_KEY_ID=$(echo "$GPG_PRIVATE_KEY" | gpg --import-options show-only --import | sed -n '2s/^\s*//p')
echo $GPG_KEY_ID
echo "$GPG_PRIVATE_KEY" | gpg --batch --passphrase "$GPG_PASSPHRASE" --import
echo "Checking GPG expirations..."
if [[ $(gpg --list-keys | grep expired) ]]; then
echo "GPG key has expired. Please update your GPG key." >&2
exit 1
fi
echo "::endgroup::"
echo "::group::Adding PPA..."
# Add extra PPA if it's been set
if [[ -n "$EXTRA_PPA" ]]; then
for ppa in $EXTRA_PPA; do
echo "Adding PPA: $ppa"
sudo add-apt-repository -y ppa:$ppa
done
fi
sudo apt-get update
echo "::endgroup::"
if [[ -z "$SERIES" ]]; then
SERIES=$(distro-info --supported)
fi
# Add extra series if it's been set
if [[ -n "$EXTRA_SERIES" ]]; then
SERIES="$EXTRA_SERIES $SERIES"
fi
mkdir -p /tmp/workspace/source
cp $TARBALL /tmp/workspace/source
if [[ -n $DEBIAN_DIR ]]; then
cp -r $DEBIAN_DIR /tmp/workspace/debian
fi
for s in $SERIES; do
ubuntu_version=$(distro-info --series $s -r | cut -d' ' -f1)
echo "::group::Building deb for: $ubuntu_version ($s)"
cp -r /tmp/workspace /tmp/$s && cd /tmp/$s/source
tar -xf ./* && cd ./*/
echo "Making non-native package..."
debmake $DEBMAKE_ARGUMENTS
if [[ -n $DEBIAN_DIR ]]; then
cp -r /tmp/$s/debian/* debian/
fi
# Extract the package name from the debian changelog
package=$(dpkg-parsechangelog --show-field Source)
pkg_version=$(dpkg-parsechangelog --show-field Version | cut -d- -f1)
changes="New upstream release"
# Create the debian changelog
rm -rf debian/changelog
dch --create --distribution $s --package $package --newversion $pkg_version-ppa$REVISION~ubuntu$ubuntu_version "$changes"
# Install build dependencies
sudo mk-build-deps --install --remove --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
debuild -S -sa \
-k"$GPG_KEY_ID" \
-p"gpg --batch --passphrase "$GPG_PASSPHRASE" --pinentry-mode loopback"
dput ppa:$REPOSITORY ../*.changes
echo "Uploaded $package to $REPOSITORY"
echo "::endgroup::"
done