52 lines
No EOL
1.5 KiB
YAML
52 lines
No EOL
1.5 KiB
YAML
name: Deploy Plattform-Core
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
jobs:
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Python einrichten
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11' # eure Version anpassen
|
|
|
|
- name: Dependencies installieren
|
|
run: |
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -r requirements.txt --no-cache-dir
|
|
|
|
- name: Tests ausführen
|
|
run: |
|
|
source .venv/bin/activate
|
|
pytest tests/ -v
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- name: Deploy to Infomaniak VM
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
|
|
chmod 600 ~/.ssh/deploy_key
|
|
echo "StrictHostKeyChecking=no" >> ~/.ssh/config
|
|
echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config
|
|
ssh -i ~/.ssh/deploy_key ubuntu@api.poweron.swiss "
|
|
cd /srv/gateway/current &&
|
|
git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/plattform-core.git &&
|
|
git pull &&
|
|
cp env-gateway-prod-forgejo.env .env &&
|
|
rm -f env-*.env &&
|
|
source .venv/bin/activate &&
|
|
pip install -r requirements.txt --no-cache-dir &&
|
|
sudo systemctl restart gateway
|
|
" |