Some checks failed
Build and Deploy Backend / build_and_deploy (push) Failing after 17s
75 lines
1.9 KiB
YAML
75 lines
1.9 KiB
YAML
name: Build and Deploy Backend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "backend/**"
|
|
- "pyproject.toml"
|
|
- "uv.lock"
|
|
- ".forgejo/workflows/deploy_backend.yml"
|
|
|
|
|
|
jobs:
|
|
build_and_deploy:
|
|
runs-on: roadrunner
|
|
container:
|
|
volumes:
|
|
- /opt/blauwasser-api:/opt/blauwasser-api/
|
|
|
|
|
|
steps:
|
|
- name: Deployment-Werkzeuge installieren
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends rsync curl
|
|
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
|
|
"$HOME/.local/bin/uv" --version
|
|
|
|
- name: Repository auschecken
|
|
uses: actions/checkout@v4
|
|
|
|
# - name: Backend testen
|
|
# working-directory: backend
|
|
# run: |
|
|
# python3 -m pip install --upgrade pip
|
|
# python3 -m pip install -e .
|
|
# python3 -m pytest
|
|
|
|
- name: Backend kopieren
|
|
run: |
|
|
rsync -a --no-perms --no-owner --no-group --delete \
|
|
--exclude '.venv' \
|
|
--exclude '__pycache__' \
|
|
--exclude '*.db' \
|
|
backend/ /opt/blauwasser-api/backend/
|
|
|
|
- name: SSH konfigurieren
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
openssh-client \
|
|
ca-certificates
|
|
|
|
mkdir -p "$HOME/.ssh"
|
|
chmod 700 "$HOME/.ssh"
|
|
|
|
printf '%s\n' '${{ secrets.DEPLOY_SSH_KEY }}' \
|
|
> "$HOME/.ssh/id_ed25519"
|
|
|
|
chmod 600 "$HOME/.ssh/id_ed25519"
|
|
|
|
ssh-keyscan -H host.docker.internal \
|
|
>> "$HOME/.ssh/known_hosts"
|
|
|
|
chmod 644 "$HOME/.ssh/known_hosts"
|
|
|
|
|
|
- name: Host deployment ausführen
|
|
run: |
|
|
ssh blauwasser-api@46.224.218.220 -i "$HOME/.ssh/id_ed25519" \
|
|
'sudo /opt/blauwasser-api/deploy.sh'
|