mirror of
https://github.com/theoleuthardt/werkzeugkiste.git
synced 2026-06-13 09:37:53 +00:00
Merge pull request #21 from theoleuthardt/deployment
feat: workflow fixes for deployment
This commit is contained in:
commit
c2b46b5477
1 changed files with 38 additions and 4 deletions
42
.github/workflows/deploy.yml
vendored
42
.github/workflows/deploy.yml
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build, Push and Deploy
|
name: Deploy Werkzeugkiste!
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
@ -17,8 +17,7 @@ on:
|
||||||
- 'FR FR'
|
- 'FR FR'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-push-deploy:
|
docker-build-push:
|
||||||
if: github.event.pull_request.merged == true
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -46,4 +45,39 @@ jobs:
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/werkzeugkiste-backend:latest
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/werkzeugkiste-backend:latest
|
||||||
|
|
||||||
|
deploy-on-server:
|
||||||
|
needs: docker-build-push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install Wireguard
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y wireguard-tools
|
||||||
|
|
||||||
|
- name: Setup Wireguard Configuration
|
||||||
|
run: |
|
||||||
|
sudo mkdir -p /etc/wireguard
|
||||||
|
echo "${{ secrets.VPN_CONFIG }}" | sudo tee /etc/wireguard/wg0.conf > /dev/null
|
||||||
|
sudo chmod 600 /etc/wireguard/wg0.conf
|
||||||
|
|
||||||
|
- name: Connect to Wireguard
|
||||||
|
run: |
|
||||||
|
sudo wg-quick up wg0
|
||||||
|
sleep 10
|
||||||
|
sudo wg show
|
||||||
|
|
||||||
|
|
||||||
|
- 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 }}"
|
||||||
|
sudo docker compose up -d --pull always
|
||||||
Loading…
Add table
Add a link
Reference in a new issue