CI: alle jobs op runs-on: linux; deploy draagbaar (sudo/ssh-tools alleen indien nodig), backend-test met vrije poort
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,8 +40,18 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: raspberry-pi
|
||||
runs-on: linux
|
||||
steps:
|
||||
# Runner-independent: only installs what is missing, and only uses sudo when not already root and sudo exists
|
||||
# (a container on the PC runner has neither sudo nor a need for it; the Pi runner may need it).
|
||||
- name: Ensure ssh tooling
|
||||
run: |
|
||||
SUDO=""
|
||||
if [ "$(id -u)" != "0" ] && command -v sudo >/dev/null 2>&1; then SUDO="sudo"; fi
|
||||
if ! command -v sshpass >/dev/null 2>&1 || ! command -v ssh >/dev/null 2>&1 || ! command -v scp >/dev/null 2>&1; then
|
||||
$SUDO apt-get update && $SUDO apt-get install -y sshpass openssh-client
|
||||
fi
|
||||
|
||||
- name: Compute release timestamp
|
||||
id: release
|
||||
run: echo "timestamp=$(date -u +%Y%m%d%H%M%S)" >> "$GITHUB_OUTPUT"
|
||||
@@ -68,7 +78,6 @@ jobs:
|
||||
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
|
||||
run: |
|
||||
echo "Environment: ${{ inputs.environment }}"
|
||||
sudo apt-get update && sudo apt-get install -y sshpass
|
||||
sshpass -p "$SSH_PASS" ssh \
|
||||
-p "$SSH_PORT" \
|
||||
-o StrictHostKeyChecking=no \
|
||||
@@ -92,7 +101,6 @@ jobs:
|
||||
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }}
|
||||
run: |
|
||||
echo "Environment: ${{ inputs.environment }}, transport: ${{ inputs.transport }}"
|
||||
sudo apt-get update && sudo apt-get install -y sshpass
|
||||
RELEASE_DIR="${{ inputs.deploy_path }}/releases/${{ steps.release.outputs.timestamp }}"
|
||||
sshpass -p "$SSH_PASS" ssh \
|
||||
-p "$SSH_PORT" \
|
||||
|
||||
Reference in New Issue
Block a user