forked from home-assistant/supervised-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (73 loc) · 3.31 KB
/
build-deb.yml
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
name: Build Deb Package
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
release:
types: ["published"]
jobs:
build-deb-package:
runs-on: ubuntu-latest
strategy:
matrix:
package: [ "ha", "jethome" ]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Fix scripts
if: matrix.package == 'jethome'
run: |
jh_durl="ghcr.io/jethub-homeassistant"
sed -i "s|DOCKER_REPO=\"[^\"]*\"|DOCKER_REPO=\"${jh_durl}\"|g" homeassistant-supervised/DEBIAN/postinst
jh_url="https://haversion.jethome.ru/stable.json"
sed -i "s|URL_VERSION=\"[^\"]*\"|URL_VERSION=\"${jh_url}\"|g" homeassistant-supervised/DEBIAN/postinst
jh_apparmor="https://haversion.jethome.ru/apparmor_stable.txt"
sed -i "s|URL_APPARMOR_PROFILE=\"[^\"]*\"|URL_APPARMOR_PROFILE=\"${jh_apparmor}\"|g" homeassistant-supervised/DEBIAN/postinst
package_name=homeassistant-supervised
sed -i 's|Package: homeassistant-supervised|Package: homeassistant-supervised-jethome|g' homeassistant-supervised/DEBIAN/control
sed -i 's|Description: Home Assistant Supervised|Description: Home Assistant Supervised JetHome|g' homeassistant-supervised/DEBIAN/control
for script_file in homeassistant-supervised/DEBIAN/p*; do
sed -i 's|--package homeassistant-supervised|--package homeassistant-supervised-jethome|g' "$script_file"
done
- name: Build Debian Package in Docker
run: |
docker run --rm -v $(pwd):/tmp debian:bullseye-slim bash -c \
"cd /tmp \
&& chmod 555 homeassistant-supervised/DEBIAN/p* \
&& dpkg-deb --build --root-owner-group homeassistant-supervised"
if [[ "${{ matrix.package }}" == "jethome" ]]; then
ls -la
mv homeassistant-supervised.deb homeassistant-supervised-jethome.deb || true
fi
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: homeassistant-supervised*.deb
- name: Rename for deploy
id: getfile
run: |
FILENAME="$(awk '/^Package:/ { print $2 }' homeassistant-supervised/DEBIAN/control)_$(awk '/^Version:/ { print $2 }' homeassistant-supervised/DEBIAN/control)_$(dpkg-architecture -qDEB_BUILD_ARCH).deb"
ls -la
mv $(awk '/^Package:/ { print $2 }' homeassistant-supervised/DEBIAN/control).deb ${FILENAME}
echo "filename=${FILENAME}"
echo "filename=${FILENAME}" >> $GITHUB_OUTPUT
- name: Deploy to server
if: startsWith(github.ref, 'refs/tags/')
uses: jethome-iot/actions/repo-upload@master
with:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_KNOWNHOSTS_UPLOAD: ${{ secrets.SSH_KNOWNHOSTS_UPLOAD }}
distro: bookworm
path: .
files: ${{ steps.getfile.outputs.filename }}
branch: stable
- name: Deploy to server
if: startsWith(github.ref, 'refs/tags/')
uses: jethome-iot/actions/repo-upload@master
with:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_KNOWNHOSTS_UPLOAD: ${{ secrets.SSH_KNOWNHOSTS_UPLOAD }}
distro: bookworm
path: .
files: ${{ steps.getfile.outputs.filename }}
branch: nightly