- Remove container: python:3.12-slim (lacked Node.js for actions/checkout)
- Use runner's ubuntu-latest image which has Node.js + Python pre-installed
- Fix deploy job if condition (remove ${{ }} wrapper)
- Enable debug logging in act_runner config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.2 KiB
YAML
46 lines
1.2 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: 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 --quiet
|
|
|
|
- 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/
|