ci: fix ci
Build, Test and Push Flask App / docker-build-and-push (push) Successful in 1m16s
Build, Test and Push Flask App / deploy (push) Successful in 58s

This commit is contained in:
Black_Raven committed 2026-09-11 21:52:40 +03:00
1 parent 804f84ecad
commit c06165bc3b
1 file changed
+26 -5
+26 -5
View File
@@ -55,20 +55,41 @@ jobs:
deploy:
needs: docker-build-and-push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ansible
run: apt-get update && apt-get install -y ansible
run: |
apt-get update
apt-get install -y ansible openssh-client
- name: Set up SSH key
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
printf '%s\n' "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keygen -y -f ~/.ssh/deploy_key >/dev/null
- name: Trust server host key
run: |
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
ssh-keyscan -H "${{ secrets.SERVER_IP }}" >> ~/.ssh/known_hosts
- name: Test SSH
run: |
ssh \
-i ~/.ssh/deploy_key \
-o StrictHostKeyChecking=yes \
"${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}" \
'echo SSH works'
- name: Run Ansible playbook
run: |
ansible-playbook -i "${{ secrets.SERVER_IP }}," ansible/restart_compose.yml \
ansible-playbook \
-i "${{ secrets.SERVER_IP }}," \
ansible/restart_compose.yml \
--user "${{ secrets.SERVER_USER }}" \
--private-key ~/.ssh/deploy_key