Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: CI Pipeline

on:
push:
branches: [ '**' ] # На все пуши (включая main)
branches: ['**']
pull_request:
branches: [ main ] # На PR в main
branches: [main]

permissions:
contents: read
packages: write # нужно для Docker push в GHCR
packages: write

jobs:
test:
Expand All @@ -32,20 +32,25 @@ jobs:

docker:
name: Build and push Docker image
needs: test
runs-on: ubuntu-latest
needs: test # Выполняется только если тесты прошли
if: github.event_name == 'pull_request'

# Условие: либо push в main, либо PR в main
if: |
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'

steps:
- uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set lowercase owner
- name: Owner in lowercase
id: vars
run: |
OWNER_LC=$(echo "${GITHUB_REPOSITORY%/*}" | tr '[:upper:]' '[:lower:]')
Expand Down