diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f26833b..c800fd7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,12 @@ on: branches: - main +# Осмысленное имя ранa в Actions +run-name: >- + Release: ${{ github.event.pull_request.head.ref }} → + ${{ github.event.pull_request.base.ref }} + (${{ github.event.pull_request.commits }} commits) + jobs: release: if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'stage' @@ -44,18 +50,63 @@ jobs: echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT echo "New version: $NEW_VERSION" + - name: Generate changelog from commits + id: changelog + run: | + LATEST_TAG="${{ steps.get_latest_tag.outputs.latest_tag }}" + + if [ "$LATEST_TAG" = "v0.0.0" ]; then + # Первый релиз: берём все коммиты + RANGE="" + else + RANGE="$LATEST_TAG..HEAD" + fi + + echo "Generating changelog for range: ${RANGE:-all commits}" + + REPO="$GITHUB_REPOSITORY" + + # Список коммитов в Markdown: + # - Message (`short_sha`) ([view](https://github.com/owner/repo/commit/full_sha)) + COMMITS=$(git log $RANGE \ + --pretty=format:'- %s (`%h`) ([view](https://github.com/'"$REPO"'/commit/%H))') + + if [ -z "$COMMITS" ]; then + COMMITS="- No commits since $LATEST_TAG (nothing to list)" + fi + + { + echo "changelog<> "$GITHUB_OUTPUT" + - name: Create Release uses: softprops/action-gh-release@v1 with: tag_name: ${{ steps.calculate_version.outputs.new_version }} - name: Release ${{ steps.calculate_version.outputs.new_version }} + + # Более осмысленное имя релиза + name: >- + ${{ github.event.pull_request.head.ref }} → + ${{ github.event.pull_request.base.ref }} – + ${{ steps.calculate_version.outputs.new_version }} + (${{ github.event.pull_request.commits }} commits) + body: | ## Changes in this Release - Merged from stage to main via PR #${{ github.event.pull_request.number }} + Merged from `${{ github.event.pull_request.head.ref }}` to `${{ github.event.pull_request.base.ref }}` + via PR #${{ github.event.pull_request.number }} **Pull Request:** ${{ github.event.pull_request.title }} For detailed changes, see the [Pull Request](${{ github.event.pull_request.html_url }}) + + --- + + ### Commits since ${{ steps.get_latest_tag.outputs.latest_tag }} + ${{ steps.changelog.outputs.changelog }} + draft: false prerelease: false diff --git a/.gitignore b/.gitignore index 88e78e2..d494d4b 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ test_auth_prod.php /.env.test /examples/ /.composer/ +ARCHITECTURE_ANALYSIS.md diff --git a/README.md b/README.md index 9a67bbc..97baf9e 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@ > **REST API на основе Laravel для совместного управления задачами и командами с аутентификацией через Sanctum** -[![PHP Version](https://img.shields.io/badge/PHP-8.2%2B-777BB4?style=flat-square&logo=php)](https://www.php.net/) -[![Laravel](https://img.shields.io/badge/Laravel-11.x-FF2D20?style=flat-square&logo=laravel)](https://laravel.com) -[![License](https://img.shields.io/badge/License-MIT-green.svg?style=flat-square)](LICENSE) -[![Tests CI](https://github.com/sni10/Tasks-Laravel-REST-API-examples/actions/workflows/tests.yml/badge.svg)](https://github.com/sni10/Tasks-Laravel-REST-API-examples/actions/workflows/tests.yml) -[![PHPUnit](https://img.shields.io/badge/Tests-PHPUnit-4F5B93?style=flat-square&logo=php)](https://phpunit.de/) -[![Coverage](https://img.shields.io/badge/Coverage-PHPUnit%20HTML-informational?style=flat-square)](#tests) -[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=flat-square&logo=docker)](https://www.docker.com/) +[![Release](https://img.shields.io/github/v/release/sni10/Tasks-Laravel-REST-API-examples?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sni10/Tasks-Laravel-REST-API-examples/releases) +[![Release Workflow](https://img.shields.io/github/actions/workflow/status/sni10/Tasks-Laravel-REST-API-examples/release.yml?style=for-the-badge&logo=githubactions&logoColor=white&label=Release)](https://github.com/sni10/Tasks-Laravel-REST-API-examples/actions/workflows/release.yml) +[![Tests](https://img.shields.io/github/actions/workflow/status/sni10/Tasks-Laravel-REST-API-examples/tests.yml?style=for-the-badge&logo=githubactions&logoColor=white&label=Tests)](https://github.com/sni10/Tasks-Laravel-REST-API-examples/actions/workflows/tests.yml) +[![Coverage](https://img.shields.io/badge/Coverage-65%25-brightgreen?style=for-the-badge&logo=codecov&logoColor=white)](https://github.com/sni10/Tasks-Laravel-REST-API-examples/actions/workflows/tests.yml) +[![PHP](https://img.shields.io/badge/PHP-8.2%2B-777BB4?style=for-the-badge&logo=php&logoColor=white)](https://www.php.net/) +[![Laravel](https://img.shields.io/badge/Laravel-11.x-FF2D20?style=for-the-badge&logo=laravel&logoColor=white)](https://laravel.com) +[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com/) +[![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE) ## Environments @@ -17,8 +18,8 @@ ### Production environment - Использует `docker-compose.yml` как базовую конфигурацию - Настроено для боевого развёртывания с оптимизированными параметрами -- Переменные окружения: `APP_ENV=production`, `APP_DEBUG=false` -- База данных: `task_management_test` +- Переменные окружения: `APP_ENV=prod`, `APP_DEBUG=false` +- База данных: `task_management` ### Development / Testing environment - Использует `docker-compose.yml` + `docker/config-envs/test/docker-compose.override.yml`