discord-bot/.forgejo/workflows/deploy.yml
rainofdestiny e036908edb
Some checks failed
CI/CD / build (push) Failing after 28s
CI/CD / deploy (push) Has been skipped
Initial commit: Discord infrastructure bot
Commands: /status /logs /restart /deploy /metrics /backup
CI/CD: builds Docker image, pushes to git.csrx.ru registry, deploys to server

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 05:27:51 +07:00

46 lines
1.5 KiB
YAML

name: CI/CD
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
# ── Build & push Docker image ────────────────────────────────────────────
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Forgejo Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login git.csrx.ru -u ${{ github.actor }} --password-stdin
- name: Build image
run: docker build -t git.csrx.ru/jack/discord-bot:latest .
- name: Push image
run: docker push git.csrx.ru/jack/discord-bot:latest
# ── Deploy to server (master only) ───────────────────────────────────────
deploy:
needs: build
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh
printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 22 87.249.49.32 >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
- name: Pull & restart on server
run: |
ssh deploy@87.249.49.32 "
docker pull git.csrx.ru/jack/discord-bot:latest &&
docker compose -f /opt/services/docker-compose.yml up -d --no-deps discord-bot
"