infra/.forgejo/workflows/deploy.yml
jack 92d2c845d8
Some checks failed
CI/CD / syntax-check (push) Successful in 1m14s
CI/CD / deploy (push) Failing after 10m51s
feat: add n8n, outline routes, remove syncthing, fix backup awscli
- Add n8n to tools server (n8n.csrx.ru)
- Add cross-server Traefik routes: wiki.csrx.ru + n8n.csrx.ru → tools
- Remove Syncthing (replaced by Outline wiki)
- Fix awscli install: download static binary (apt/pip broken on Ubuntu 24.04)
- Add n8n secrets to vault (encryption key + JWT secret)
- Improve CI/CD workflow: syntax-check both playbooks, deploy both servers
- Update site.yml: unified single-command deploy for all servers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 06:19:39 +07:00

68 lines
2.2 KiB
YAML

name: CI/CD
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
# ── Syntax check (every PR + push) ─────────────────────────────────────────
syntax-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ansible
run: pip3 install ansible --quiet --break-system-packages
- name: Install collections
run: |
ansible-galaxy collection install \
community.general community.docker ansible.posix --force
- name: Write vault password
run: |
echo "${{ secrets.VAULT_PASSWORD }}" > ~/.vault-password-file
chmod 600 ~/.vault-password-file
- name: Syntax check — main
run: ansible-playbook playbooks/deploy.yml --syntax-check
- name: Syntax check — tools
run: ansible-playbook playbooks/tools.yml --syntax-check
# ── Deploy (push to master only, after syntax-check passes) ────────────────
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 --force
- name: Configure SSH
run: |
mkdir -p ~/.ssh
printf '%s' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Scan host keys directly (no need for SSH_KNOWN_HOSTS secret)
ssh-keyscan -p 22 87.249.49.32 >> ~/.ssh/known_hosts
ssh-keyscan -p 22 85.193.83.9 >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
- name: Write vault password
run: |
echo "${{ secrets.VAULT_PASSWORD }}" > ~/.vault-password-file
chmod 600 ~/.vault-password-file
- name: Deploy main server
run: ansible-playbook playbooks/deploy.yml -l main
- name: Deploy tools server
run: ansible-playbook playbooks/tools.yml -l tools