27 lines
856 B
Bash
27 lines
856 B
Bash
#!/bin/bash
|
|
|
|
name="webhookd"
|
|
version="1.0-0"
|
|
|
|
# Ensure permissions
|
|
chmod 0755 DEBIAN/postinst
|
|
chmod 0755 usr/local/bin/webhookd.py
|
|
chmod 0644 etc/systemd/system/webhookd.service
|
|
|
|
# Package
|
|
mkdir -p ${name}_${version}_all/{DEBIAN,etc/systemd/system,usr/local/bin};
|
|
cp -r DEBIAN ${name}_${version}_all/;
|
|
cp -r etc ${name}_${version}_all/;
|
|
cp -r usr ${name}_${version}_all/;
|
|
|
|
dpkg-deb --build --root-owner-group ${name}_${version}_all
|
|
|
|
if [ $? -eq 0 ]; then
|
|
RELEASE_ID=$(curl -s -H "Authorization: token REDACTED" \
|
|
"https://git.unblue.uk/api/v1/repos/Unblue/${name}/releases/tags/v${version}" | jq '.id')
|
|
|
|
curl -X POST "https://git.unblue.uk/api/v1/repos/Unblue/${name}/releases/${RELEASE_ID}/assets" \
|
|
-H "Authorization: token ${GIT_TOKEN}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@${name}_${version}_all.deb"
|
|
fi |