diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..66a257b --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,47 @@ +name: Build + +on: + push: + branches: + - main + +jobs: + + build: + runs-on: docker + container: + image: debian:bookworm + + steps: + - run: |- + apt update + apt install -y nodejs git curl golang + - uses: actions/checkout@v4 + + - run: go build -o bitvis-http + + - name: Build Debian package + run: |- + mkdir -p deb/DEBIAN + cat < + Description: Virtual BitPanel over HTTP + EOF + install -D -m 0755 support/postinst deb/DEBIAN/postinst + install -D -m 0755 bitvis-http deb/usr/bin/bitvis-http + install -D support/systemd.service deb/lib/systemd/system/bitvis-http.service + + dpkg-deb --build deb bitvis-http.deb + + - name: Deploy Debian package + run: |- + curl \ + --fail \ + --user ${{ secrets.PKG_RELEASE_CREDENTIALS }} \ + --upload-file bitvis-http.deb \ + $GITHUB_SERVER_URL/api/packages/$GITHUB_REPOSITORY_OWNER/debian/pool/stable/main/upload diff --git a/support/postinst b/support/postinst new file mode 100644 index 0000000..1d60e3c --- /dev/null +++ b/support/postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +systemctl daemon-reload +systemctl restart bitvis-http.service +systemctl enable bitvis-http.service diff --git a/support/systemd.service b/support/systemd.service new file mode 100644 index 0000000..a60bb21 --- /dev/null +++ b/support/systemd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Virtual BitPanel over HTTP +After=network.target + +[Service] +Type=simple +Restart=always +RestartSec=10s +ExecStart=/usr/bin/bitvis-http +DynamicUser=true + +[Install] +WantedBy=multi-user.target