From 1ffe7b48d2fcf5f3069b16ed8ca34d88869983af Mon Sep 17 00:00:00 2001 From: "alireza.hassani" Date: Sun, 24 May 2026 17:59:58 +0000 Subject: [PATCH] Update .gitea/workflows/publish.yml --- .gitea/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index 6a54f4a..1aed396 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -44,6 +44,40 @@ jobs: secrets: | gitea_token=${{ secrets.TOKEN }} + +deploy: + name: Deploy Job + runs-on: ubuntu-latest + needs: build # Recommended: ensures deploy only runs if build succeeds + + permissions: + contents: read + security-events: write + actions: read + id-token: write + + steps: + - name: Deploy to server via native SSH + run: | + # 1. Setup SSH directory + mkdir -p ~/.ssh + chmod 700 ~/.ssh + + # 2. Add host to known_hosts to bypass prompt + ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts + + # 3. Setup the private key + echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + + # 4. Connect and execute commands + ssh -i ~/.ssh/id_rsa ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' + cd /apps/admin-front + docker pull git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} + IMAGE=git.meshkee.com/${{ gitea.repository }}:${{ gitea.ref_name }} docker compose up -d + EOF + + # deploy: # name: Deploy Job # runs-on: ubuntu-latest