added ci/cd
CI/CD / build (push) Successful in 2m17s
CI/CD / deploy (push) Failing after 10s

This commit is contained in:
2026-07-10 00:13:57 +02:00
parent 7f17a604e5
commit cbefb7b21f
4 changed files with 111 additions and 5 deletions
+49
View File
@@ -0,0 +1,49 @@
name: CI/CD
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 25
- name: Build
run: |
chmod +x gradlew
./gradlew --no-daemon build
deploy:
runs-on: ubuntu-latest
needs: build
if: gitea.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Build & push Docker image
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
docker login git.${{ secrets.DOMAIN }} \
-u ${{ secrets.REGISTRY_USER }} --password-stdin
docker build -t git.${{ secrets.DOMAIN }}/${{ secrets.REGISTRY_USER }}/botinator:latest .
docker push git.${{ secrets.DOMAIN }}/${{ secrets.REGISTRY_USER }}/botinator:latest
- name: Deploy to VPS
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/key
chmod 600 ~/.ssh/key
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
ssh -i ~/.ssh/key \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"cd ~/programs/botinator && docker compose pull && docker compose up -d"