From ab5635b057a1e09385da2b5bb42ce2862313b3cd Mon Sep 17 00:00:00 2001 From: loki Date: Sat, 21 Jun 2025 04:35:07 +1000 Subject: [PATCH] commit --- .github/deploy.sh | 19 +++++++++++++++++++ .github/workflows/deploy.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 .github/deploy.sh create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/deploy.sh b/.github/deploy.sh new file mode 100755 index 0000000..8506984 --- /dev/null +++ b/.github/deploy.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +REPO_DIR="/home/loki/www/gunlinux.ru" +BRANCH="master" + +# Navigate to the repository directory +cd $REPO_DIR || exit + +# Fetch and reset changes from the remote repository +git fetch --all +git reset --hard origin/$BRANCH + +# Optionally run build or install commands here if needed +# e.g., npm install, yarn install for Node.js projects + +# Restart services using sudo +sudo systemctl restart gunlinux.ru + +echo "Deployment completed successfully." diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..23850ba --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,26 @@ +name: Deploy to Server + +on: + push: + branches: + - master # or any other branch you want to deploy from + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: test secrests + run: | + echo ${{ secrets.USERNAME }} + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: | + ${{ secrets.PRIVATE_KEY_SSH }} + + - name: Deploy to Server + run: | + ssh -o "StrictHostKeyChecking=no" "loki@gunlinux.ru" 'bash -s' < .github/deploy.sh