Files
max-telegram-bridge-bot/.gitea/workflows/deploy.yml
T
dmysob d28b142441
Build and Deploy / Check and Build (push) Failing after 46s
Build and Deploy / Deploy to Production (push) Has been skipped
v0.3.22 chore: исправить deploy job для Linux-совместимости, секреты Gitea
2026-05-27 15:05:51 +09:00

54 lines
1.3 KiB
YAML

name: Build and Deploy
run-name: Deploy ${{ gitea.ref_name }}
on:
push:
branches: [main]
tags: ['v*']
jobs:
ci:
name: Check and Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Vet
run: go vet ./...
- name: Test
run: go test ./...
- name: Build binary
run: CGO_ENABLED=1 go build -o max-telegram-bridge-bot .
deploy:
name: Deploy to Production
needs: ci
runs-on: ubuntu-latest
if: ${{ gitea.ref_name == 'main' || startsWith(gitea.ref_name, 'v') }}
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t max-telegram-bridge-bot:latest .
- name: Create .env file from secrets
run: |
echo "TG_TOKEN=${{ secrets.TG_TOKEN }}" > .env
echo "MAX_TOKEN=${{ secrets.MAX_TOKEN }}" >> .env
echo "TG_API_URL=${{ secrets.TG_API_URL }}" >> .env
- name: Deploy with Docker Compose
run: docker-compose up -d
- name: Health check
run: |
echo "Waiting for container to start..."
sleep 10
docker ps --filter "name=bridge" --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"