60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
name: Test & Deploy to Snapdeploy
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build-test-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
# ---------- Сборка основного образа ----------
|
|
- name: Build eventhub image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: docker/Dockerfile
|
|
load: true
|
|
tags: eventhub:latest
|
|
|
|
# ---------- Сборка тестового образа поверх eventhub ----------
|
|
- name: Build API test image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: docker/ApiTests.Dockerfile
|
|
load: true
|
|
tags: eventhub-api-tests:latest
|
|
|
|
# ---------- Запуск тестов ----------
|
|
- name: Run API tests
|
|
run: |
|
|
docker run --rm eventhub-api-tests:latest
|
|
|
|
- name: Login to Gitea Container Registry
|
|
if: success()
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: git.sabilin.com
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Tag and push eventhub image
|
|
if: success()
|
|
run: |
|
|
docker tag eventhub:latest git.sabilin.com/eventhub/eventhub:test
|
|
docker push git.sabilin.com/eventhub/eventhub:test
|
|
|
|
# ---------- Деплой на Snapdeploy ----------
|
|
- name: Deploy to Snapdeploy
|
|
if: success()
|
|
run: |
|
|
# TODO: замените на реальный вызов API Snapdeploy
|
|
echo "Deploying to Snapdeploy test environment..."
|
|
# curl -X POST https://api.snapdeploy.dev/deploy \
|
|
# -H "Authorization: Bearer ${{ secrets.SNAPDEPLOY_TOKEN }}" \
|
|
# ... |