From a31ef83aa5b2f09249d40c51d597b5b29df68422 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Tue, 10 Dec 2024 20:52:05 +0400 Subject: [PATCH] ISSUE-337: phpdoc --- .github/workflows/core-docs.yml | 44 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/core-docs.yml b/.github/workflows/core-docs.yml index e4884d8..4c7d0c8 100644 --- a/.github/workflows/core-docs.yml +++ b/.github/workflows/core-docs.yml @@ -6,21 +6,19 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + uses: shivammathur/setup-php@v2 with: php-version: 8.1 extensions: mbstring, dom, fileinfo, mysql - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV - name: Cache composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: - path: ${{ steps.composer-cache.outputs.dir }} - # Use composer.json for key, if composer.lock is not committed. - # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + path: ${{ env.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install current dependencies from composer.lock @@ -34,48 +32,54 @@ jobs: run: phpDocumentor --version - name: Generate documentation run: composer run-php-documentor - - name: zip phpdocumentor dir + - name: Zip phpDocumentor directory run: zip -r phpdocumentor.zip docs/phpdocumentor - name: Upload generated doc files - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: doc-files path: phpdocumentor.zip deploy-docs: - name: Deploy Core Docs. + name: Deploy Core Docs runs-on: ubuntu-20.04 needs: make-restapi-docs steps: - name: Checkout phplist/core-docs - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: phpList/core-docs fetch-depth: 0 token: ${{ secrets.PUSH_CORE_DOCS }} - name: Restore REST API Spec - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: doc-files - - name: unzip phpdocumentor + - name: Unzip phpDocumentor run: | unzip phpdocumentor.zip rm phpdocumentor.zip - name: List Files run: ls - - name: Sync old files with newly generated ones. + - name: Sync old files with newly generated ones run: rsync -av docs/phpdocumentor/* . - - name: Removed temp dirs + - name: Remove temporary directories run: rm -rf docs - - name: Check if updates/changes. + - name: Check if updates/changes run: git status --porcelain > repo-changes.txt - name: Check changes file run: cat repo-changes.txt - - name: Verify updates. + - name: Verify updates id: allow-deploy run: | - if [ -s repo-changes.txt ]; then echo "Updates made to documentation"; echo '::set-output name=DEPLOY::true'; else echo "No updates made to documentation deployment would be skipped."; echo '::set-output name=DEPLOY::false'; fi - - name: Commit changes and deply - if: ${{ steps.allow-deploy.outputs.DEPLOY == 'true' }} + if [ -s repo-changes.txt ]; then + echo "Updates made to documentation"; + echo 'DEPLOY=true' >> $GITHUB_ENV; + else + echo "No updates made to documentation. Deployment would be skipped."; + echo 'DEPLOY=false' >> $GITHUB_ENV; + fi + - name: Commit changes and deploy + if: ${{ env.DEPLOY == 'true' }} run: | rm repo-changes.txt git config user.name "github-actions"