forked from dtcooper/raspotify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-apt-repo.sh
executable file
·82 lines (63 loc) · 2.31 KB
/
deploy-apt-repo.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
#!/bin/sh
set -e
if [ ! -d apt-repo ]; then
echo 'Clone gh-pages branch into apt-repo folder: '
echo ' git clone -b gh-pages --single-branch git@github.com:dtcooper/raspotify.git apt-repo'
exit 1
fi
if [ -z "$GPG_KEY_ID" ]; then
echo 'Set environment variable GPG_KEY_ID'
exit 1
fi
if [ -z "$GPG_SECRET_KEY_BASE64" ]; then
echo 'Set environment variable GPG_SECRET_KEY_BASE64'
exit 1
fi
if [ -z "$RELEASE_TAG" ]; then
echo 'Set environment variable RELEASE_TAG'
exit 1
fi
if [ $(ls -1 *_armhf.deb | wc -l) -ne 1 ]; then
echo 'Exactly one *_armhf.deb package needs to be in folder.'
exit 1
fi
if [ $(ls -1 *_arm64.deb | wc -l) -ne 1 ]; then
echo 'Exactly one *_arm64.deb package needs to be in folder.'
exit 1
fi
if [ $(ls -1 *_amd64.deb | wc -l) -ne 1 ]; then
echo 'Exactly one *_amd64.deb package needs to be in folder.'
exit 1
fi
ARMHF_DEB_PKG_NAME="$(ls -1 *_armhf.deb | head -n 1)"
echo "Using package: $ARMHF_DEB_PKG_NAME"
ARM64_DEB_PKG_NAME="$(ls -1 *_arm64.deb | head -n 1)"
echo "Using package: $ARM64_DEB_PKG_NAME"
AMD64_DEB_PKG_NAME="$(ls -1 *_amd64.deb | head -n 1)"
echo "Using package: $AMD64_DEB_PKG_NAME"
echo "Importing gpg key"
echo "$GPG_SECRET_KEY_BASE64" | base64 -d | gpg --import
cd apt-repo
# Clear out old stuff
rm -rf conf db pool dists
mkdir conf
cat <<EOF > conf/distributions
Codename: raspotify
Components: main
Architectures: armhf arm64 amd64
SignWith: $GPG_KEY_ID
EOF
reprepro includedeb raspotify "../$ARMHF_DEB_PKG_NAME"
reprepro includedeb raspotify "../$ARM64_DEB_PKG_NAME"
reprepro includedeb raspotify "../$AMD64_DEB_PKG_NAME"
rm -rf conf db
ln -fs "$(find . -name '*_armhf.deb' -type f -printf '%P\n' -quit)" raspotify-latest_armhf.deb
ln -fs "$(find . -name '*_arm64.deb' -type f -printf '%P\n' -quit)" raspotify-latest_arm64.deb
ln -fs "$(find . -name '*_amd64.deb' -type f -printf '%P\n' -quit)" raspotify-latest_amd64.deb
echo "Repo created in directory apt-repo with packages $ARMHF_DEB_PKG_NAME, $ARM64_DEB_PKG_NAME and $AMD64_DEB_PKG_NAME"
gpg --armor --export "$GPG_KEY_ID" > key.asc
cp -v ../README.md ../LICENSE ../install.sh .
git add -A
git -c 'user.name=Automated Release' -c 'user.email=automated-release@users.noreply.github.com' \
commit -m "Update gh-pages apt repository (released tag $RELEASE_TAG)"
git push origin gh-pages