126 lines
3.8 KiB
YAML
126 lines
3.8 KiB
YAML
name: Build, Test and Publish Debian Packages
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
paths:
|
|
- 'sources/**'
|
|
- 'buildpackages.sh'
|
|
- '.gitea/workflows/**'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Packages
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y dpkg-dev rsync
|
|
|
|
- name: Build all packages
|
|
run: |
|
|
chmod +x buildpackages.sh
|
|
./buildpackages.sh all
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: debian-packages
|
|
path: staging/*.deb
|
|
|
|
test-install:
|
|
name: Test Package Installation
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download built artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: debian-packages
|
|
path: staging
|
|
|
|
- name: Install system runtime dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y python3 python3-pip python3-venv ffmpeg
|
|
|
|
- name: Test install eendoe-repository
|
|
run: |
|
|
echo "=== Installing eendoe-repository ==="
|
|
sudo apt-get install -y ./staging/eendoe-repository-*.deb
|
|
dpkg -s eendoe-repository | grep -q "Status: install ok installed"
|
|
test -f /etc/apt/sources.list.d/eendoe.list
|
|
echo "eendoe-repository: OK"
|
|
|
|
- name: Test install eendoe-srs
|
|
run: |
|
|
echo "=== Installing eendoe-srs ==="
|
|
sudo apt-get install -y ./staging/eendoe-srs-*.deb
|
|
dpkg -s eendoe-srs | grep -q "Status: install ok installed"
|
|
test -x /usr/share/srs/objs/srs
|
|
echo "eendoe-srs: OK"
|
|
|
|
- name: Test install eendoe-hyperdeck
|
|
run: |
|
|
echo "=== Installing eendoe-hyperdeck ==="
|
|
sudo apt-get install -y ./staging/eendoe-hyperdeck-*.deb
|
|
dpkg -s eendoe-hyperdeck | grep -q "Status: install ok installed"
|
|
test -d /usr/share/hyperdeck
|
|
test -f /etc/hyperdeck/config.json
|
|
test -f /usr/lib/systemd/system/hyperdeck.service
|
|
python3 -m py_compile /usr/share/hyperdeck/main.py
|
|
echo "eendoe-hyperdeck: OK"
|
|
|
|
- name: Test package uninstall and cleanup
|
|
run: |
|
|
echo "=== Testing package removal ==="
|
|
sudo apt-get remove -y eendoe-hyperdeck eendoe-srs eendoe-repository
|
|
echo "Package removal: OK"
|
|
|
|
publish:
|
|
name: Publish to eendoe repository
|
|
needs: [build, test-install]
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download built artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: debian-packages
|
|
path: staging
|
|
|
|
- name: Deploy packages to eendoe server
|
|
env:
|
|
SSH_KEY: ${{ secrets.EENDOE_SSH_KEY }}
|
|
REMOTE_HOST: "eendoe.nl"
|
|
REMOTE_USER: "bart"
|
|
REMOTE_DIR: "/sites/repository/staging/"
|
|
run: |
|
|
if [ -n "$SSH_KEY" ]; then
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H "$REMOTE_HOST" >> ~/.ssh/known_hosts 2>/dev/null
|
|
rsync -avz staging/*.deb "${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}"
|
|
echo "Successfully deployed packages to $REMOTE_HOST:$REMOTE_DIR"
|
|
else
|
|
echo "Secret EENDOE_SSH_KEY not configured. Skipping automated remote sync."
|
|
fi
|