infra/.forgejo/workflows/deploy.yml
jack 48f34e3e93
Some checks failed
CI/CD / syntax-check (push) Successful in 2m9s
CI/CD / deploy (push) Failing after 3m0s
ci: fix ansible-galaxy --quiet flag (not supported)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 23:31:33 +07:00

51 lines
1.4 KiB
YAML

name: CI/CD
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
syntax-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ansible
run: pip3 install ansible --quiet --break-system-packages
- name: Write vault password
run: |
echo "${{ secrets.VAULT_PASSWORD }}" > ~/.vault-password-file
chmod 600 ~/.vault-password-file
- name: Syntax check
run: ansible-playbook playbooks/deploy.yml --syntax-check -i inventory/
deploy:
needs: syntax-check
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip3 install ansible --quiet --break-system-packages
ansible-galaxy collection install ansible.posix community.general community.docker
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 22 87.249.49.32 >> ~/.ssh/known_hosts
- name: Write vault password
run: |
echo "${{ secrets.VAULT_PASSWORD }}" > ~/.vault-password-file
chmod 600 ~/.vault-password-file
- name: Deploy
run: ansible-playbook playbooks/deploy.yml -i inventory/