From 0aa9c6f898741c83cc364a79aefb381dc2ad5d28 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Thu, 27 Nov 2025 20:19:51 +0400 Subject: [PATCH] ci: add docs generation into the release github action --- .github/workflows/docs.yml | 76 ----------------------------------- .github/workflows/release.yml | 47 +++++++++++++++++++++- 2 files changed, 45 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 568f847..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Deploy DocC Documentation - -on: - push: - branches: ["main"] - workflow_dispatch: - inputs: - version: - description: 'Documentation version' - required: false - default: latest' - -permissions: - contents: write - -concurrency: - group: "pages" - cancel-in-progress: true - -jobs: - deploy: - runs-on: macos-15 - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Setup Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: Get Version - id: version - run: | - if [ -n "${{ github.event.inputs.version }}" ]; then - VERSION="${{ github.event.inputs.version }}" - else - VERSION="latest" - fi - echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - echo "Building documentation for version: $VERSION" - - - name: Build DocC - id: build - uses: space-code/build-docc@main - with: - schemes: '["ValidatorCore", "ValidatorUI"]' - version: ${{ steps.version.outputs.version }} - - - name: Generate Index Page - uses: space-code/generate-index@v1.0.0 - with: - version: ${{ steps.version.outputs.version }} - project-name: 'Validator' - project-description: 'Validator is a modern, lightweight Swift framework that provides elegant and type-safe input validation.' - modules: | - [ - { - "name": "ValidatorCore", - "path": "validatorcore", - "description": "Core validation functionality and rules for Swift applications. Contains base types, protocols, and validator implementations.", - "badge": "Core Module" - }, - { - "name": "ValidatorUI", - "path": "validatorui", - "description": "UI components and helpers for building validation interfaces. Ready-to-use solutions for SwiftUI and UIKit.", - "badge": "UI Module" - } - ] - - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e8c2380..63d519d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,7 +67,15 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo "RELEASE_NOTES<> "$GITHUB_OUTPUT" - git cliff --config ./cliff.toml --latest >> "$GITHUB_OUTPUT" + + echo "All notable changes to this project will be documented in this file." >> "$GITHUB_OUTPUT" + echo "" >> "$GITHUB_OUTPUT" + echo "The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)," >> "$GITHUB_OUTPUT" + echo "and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)." >> "$GITHUB_OUTPUT" + echo "" >> "$GITHUB_OUTPUT" + + git cliff --config ./cliff.toml --latest --strip header | awk 'NF{p=1} p' | tail -n +2 >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" - name: Commit changes id: auto-commit-action @@ -87,4 +95,39 @@ jobs: name: ${{ steps.next-version.outputs.NEXT_VERSION }} tag_name: ${{ steps.next-version.outputs.NEXT_VERSION }} body: ${{ steps.release-notes.outputs.RELEASE_NOTES }} - target_commitish: ${{ steps.auto-commit-action.outputs.commit_hash }} \ No newline at end of file + target_commitish: ${{ steps.auto-commit-action.outputs.commit_hash }} + - name: Build DocC + id: build + uses: space-code/build-docc@main + if: steps.check-changes.outputs.has-changes == 'true' + with: + schemes: '["ValidatorCore", "ValidatorUI"]' + version: ${{ steps.next-version.outputs.NEXT_VERSION }} + - name: Generate Index Page + uses: space-code/generate-index@v1.0.0 + if: steps.check-changes.outputs.has-changes == 'true' + with: + version: ${{ steps.next-version.outputs.NEXT_VERSION }} + project-name: 'Validator' + project-description: 'Validator is a modern, lightweight Swift framework that provides elegant and type-safe input validation.' + modules: | + [ + { + "name": "ValidatorCore", + "path": "validatorcore", + "description": "Core validation functionality and rules for Swift applications. Contains base types, protocols, and validator implementations.", + "badge": "Core Module" + }, + { + "name": "ValidatorUI", + "path": "validatorui", + "description": "UI components and helpers for building validation interfaces. Ready-to-use solutions for SwiftUI and UIKit.", + "badge": "UI Module" + } + ] + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + if: steps.check-changes.outputs.has-changes == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs \ No newline at end of file