mirror of
https://github.com/theoleuthardt/werkzeugkiste.git
synced 2026-06-13 09:37:53 +00:00
76 lines
No EOL
1.9 KiB
YAML
76 lines
No EOL
1.9 KiB
YAML
name: Deploy Werkzeugkiste!
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [ main ]
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
question:
|
|
description: 'NextJS on top?'
|
|
required: false
|
|
default: 'FR'
|
|
type: choice
|
|
options:
|
|
- 'FR'
|
|
- 'FR FR'
|
|
|
|
jobs:
|
|
docker-build-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and Push Frontend
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./frontend
|
|
push: true
|
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/werkzeugkiste-frontend:latest
|
|
|
|
- name: Build and Push Backend
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./backend
|
|
push: true
|
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/werkzeugkiste-backend:latest
|
|
|
|
deploy-on-server:
|
|
needs: docker-build-push
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Install OpenVPN
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y openvpn
|
|
|
|
- name: Connect to VPN
|
|
run: |
|
|
echo "${{ secrets.VPN_CONFIG }}" > config.ovpn
|
|
sudo openvpn --config config.ovpn --daemon
|
|
sleep 10
|
|
|
|
- name: Deploy on Server
|
|
uses: appleboy/ssh-action@v1.2.1
|
|
with:
|
|
host: ${{ secrets.SSH_HOST }}
|
|
username: ${{ secrets.SSH_USERNAME }}
|
|
key: ${{ secrets.SSH_KEY }}
|
|
passphrase: ${{ secrets.SSH_PASSPHRASE }}
|
|
port: ${{ secrets.PORT }}
|
|
script: |
|
|
cd "${{ secrets.HOMELAB_PATH }}"
|
|
docker compose up -d --pull always |