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

This commit is contained in:
Black_Raven committed 2026-09-11 22:22:39 +03:00
1 parent 8437857ec1
commit b13f2ccddc
1 file changed
+26 -5
@@ -55,20 +55,41 @@ jobs:
deploy: deploy:
needs: docker-build-and-push needs: docker-build-and-push
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
uses: actions/checkout@v4
- name: Install Ansible - 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 - name: Set up SSH key
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: | run: |
mkdir -p ~/.ssh 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 chmod 600 ~/.ssh/deploy_key
ssh-keygen -y -f ~/.ssh/deploy_key >/dev/null
- name: Trust server host key - name: Trust server host key
run: | 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 - name: Run Ansible playbook
run: | 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 }}" \ --user "${{ secrets.SERVER_USER }}" \
--private-key ~/.ssh/deploy_key --private-key ~/.ssh/deploy_key