From 79c02c907ec3095708e55601553cba6002899c8e Mon Sep 17 00:00:00 2001 From: Namonay Date: Thu, 27 Nov 2025 12:03:23 +0000 Subject: [PATCH] add: CI --- .gitea/workflows/deploy.yaml | 47 ++++++++++++++++++++++++++++++++++++ test | 0 2 files changed, 47 insertions(+) create mode 100644 .gitea/workflows/deploy.yaml create mode 100644 test diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..4bb2d13 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,47 @@ +name: Deploy via SSH on push +run-name: ${{ gitea.actor }} is deploying via SSH + +on: + push: + branches: + - main + +jobs: + deploy-via-ssh: + runs-on: ubuntu-latest + + steps: + - run: echo "The job was triggered by a ${{ gitea.event_name }} event." + - run: echo "Branch: ${{ gitea.ref }}, Repository: ${{ gitea.repository }}" + + - name: Check out repository code + uses: actions/checkout@v4 + + - run: echo "Repository ${{ gitea.repository }} has been cloned to the runner." + + - name: Install SSH client and Git + run: | + sudo apt-get update + sudo apt-get install -y openssh-client git + + - name: Configure SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config + + - name: Deploy via SSH + run: | + echo "Connecting to ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} to deploy..." + ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' + cd /path/to/your/project + echo "Pulling latest changes from main..." + git pull origin main + echo "Restarting Docker Compose services..." + docker-compose down + docker-compose up -d --build + echo "Deployment completed!" + EOF + + - run: echo "The deployment job has finished with status ${{ job.status }}." diff --git a/test b/test new file mode 100644 index 0000000..e69de29