From 9c204bb900d19f515f03c8d318052ca3893ff33d Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Thu, 13 Jun 2024 16:39:22 +0200 Subject: [PATCH] Fixed GH Actions for docs --- .github/workflows/build-test-docs.yml | 60 ------------------- .../workflows/{deploy-docs.yml => docs.yml} | 48 ++++++++++++++- 2 files changed, 46 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/build-test-docs.yml rename .github/workflows/{deploy-docs.yml => docs.yml} (60%) diff --git a/.github/workflows/build-test-docs.yml b/.github/workflows/build-test-docs.yml deleted file mode 100644 index ffe72454..00000000 --- a/.github/workflows/build-test-docs.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build and test documentation - -on: - pull_request: - paths: - - 'docs/pages/**' - - '.github/workflows/**' - workflow_dispatch: - workflow_call: - -permissions: - id-token: write - pages: write - -env: - INSTANCE: 'kotlinx-rpc/rpc' - ARTIFACT: 'webHelpRPC2-all.zip' - DOCKER_VERSION: '241.15989' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Build docs using Writerside Docker builder - uses: JetBrains/writerside-github-action@v4 - with: - instance: ${{ env.INSTANCE }} - artifact: ${{ env.ARTIFACT }} - docker-version: ${{ env.DOCKER_VERSION }} - location: docs/pages/kotlinx-rpc/ - - - name: Save artifact with build results - uses: actions/upload-artifact@v4 - with: - name: kotlinx-rpc - path: | - artifacts/${{ env.ARTIFACT }} - artifacts/report.json - artifacts/${{ env.ALGOLIA_ARTIFACT }} - retention-days: 7 - - test: - needs: build - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: kotlinx-rpc - path: artifacts - - - name: Test documentation - uses: JetBrains/writerside-checker-action@v1 - with: - instance: ${{ env.INSTANCE }} diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/docs.yml similarity index 60% rename from .github/workflows/deploy-docs.yml rename to .github/workflows/docs.yml index 640307c4..3c6678d4 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/docs.yml @@ -3,6 +3,10 @@ name: Deploy documentation and indexes on: push: branches: ["main"] + pull_request: + paths: + - 'docs/pages/**' + - '.github/workflows/**' workflow_dispatch: permissions: @@ -21,10 +25,49 @@ env: CONFIG_JSON_VERSION: '0.1.0' jobs: - build-and-test: - uses: ./.github/workflows/build-test-docs.yml + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build docs using Writerside Docker builder + uses: JetBrains/writerside-github-action@v4 + with: + instance: ${{ env.INSTANCE }} + artifact: ${{ env.ARTIFACT }} + docker-version: ${{ env.DOCKER_VERSION }} + location: docs/pages/kotlinx-rpc/ + + - name: Save artifact with build results + uses: actions/upload-artifact@v4 + with: + name: kotlinx-rpc + path: | + artifacts/${{ env.ARTIFACT }} + artifacts/report.json + artifacts/${{ env.ALGOLIA_ARTIFACT }} + retention-days: 7 + + test: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: kotlinx-rpc + path: artifacts + + - name: Test documentation + uses: JetBrains/writerside-checker-action@v1 + with: + instance: ${{ env.INSTANCE }} deploy: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -52,6 +95,7 @@ jobs: uses: actions/deploy-pages@v4 publish-indexes: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' needs: [ build, test, deploy ] runs-on: ubuntu-latest container: