diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 1adfe1aa34..9cd2937d30 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -9,92 +9,8 @@ permissions: packages: read jobs: - build_blazor: - runs-on: ubuntu-22.04 - - container: - image: ghcr.io/telerik/blazor-build:dev - credentials: - username: ${{ github.actor }} - password: ${{ github.token }} - options: --user 1001 --shm-size="8g" - - env: - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_INSTALL_DIR: ./.dotnet - SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt - - defaults: - run: - # Use a login Bash shell to enable RVM - shell: bash -leo pipefail {0} - - steps: - - name: Import Secrets - id: import-secrets - uses: LanceMcCarthy/akeyless-action@v3 - with: - access-id: ${{ secrets.GH_AKEYLESS_ACCESS_ID }} - static-secrets: | - { - "/WebComponents/prod/tokens/GH_TOKEN": "GH_TOKEN" - } - export-secrets-to-environment: false - - - name: Clone Blazor Repository - uses: actions/checkout@v4 - with: - repository: telerik/blazor - path: temp/blazor - fetch-depth: "0" - ref: master - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "6.x.x" - - - name: Setup Telerik Nuget Feeds - uses: telerik/actions/setup-telerik-nuget-feeds@master - with: - ak-vault-token: ${{ secrets.AK_VAULT_TOKEN_PACKAGE_READER }} - - - name: Pack Telerik.Blazor and copy docs API needed resources - run: | - mkdir -p BinAndXml - dotnet pack blazor/Telerik.Blazor/Telerik.Blazor.csproj --configuration Release -p:IsTrial='false' - cp blazor/Telerik.Blazor/bin/Release/net6.0/Telerik.Blazor.dll BinAndXml - cp blazor/Telerik.Blazor/bin/Release/net6.0/Telerik.Blazor.xml BinAndXml - ls BinAndXml - working-directory: temp - - - name: Get DataSource bin and xml files - uses: telerik/actions/get-release-assets@master - with: - repo: telerik-datasource - pattern: debug-assets.zip - dir: temp/datasource - token: ${{ steps.import-secrets.outputs.GH_TOKEN }} - unzip: true - verify-attestation: true - - - name: Move DataSource bin and xml to BinAndXml folder - run: | - cp datasource/net6.0/Telerik.DataSource.dll BinAndXml - cp datasource/net6.0/Telerik.DataSource.xml BinAndXml - ls BinAndXml - working-directory: temp - - - name: Upload BinAndXml folder artifacts - uses: actions/upload-artifact@v4.3.6 - with: - name: BinAndXml - retention-days: 2 - path: temp/BinAndXml - - extract-metadata: - runs-on: windows-latest - needs: build_blazor + build-docs: + runs-on: ubuntu-latest permissions: id-token: write # Required by Akeyless contents: write @@ -110,76 +26,42 @@ jobs: } export-secrets-to-environment: false - - name: Check out Blazor-Docs repo - uses: actions/checkout@v4 - with: - sparse-checkout: _assetsApi - ref: ${{ github.ref_name }} - token: ${{ steps.import-secrets.outputs.GH_TOKEN }} - fetch-depth: "0" - - - name: Download Binaries - uses: actions/download-artifact@v4.1.7 - with: - name: BinAndXml - path: src - - - name: Copy docfx config files + - name: Install GitHub CLI run: | - copy .\_assetsApi\filterConfig.yml .\filterConfig.yml - copy .\_assetsApi\metadata-config.json .\metadata-config.json - - - name: Install docfx - run: dotnet tool update -g docfx - - - name: Generate metadata - run: docfx metadata-config.json - - - name: Zip metadata - run: 7z a metadata.zip .\metadata\* - - - name: Upload metadata artifacts - uses: actions/upload-artifact@v4.3.6 + sudo apt update + sudo apt install -y gh + + - name: Authenticate GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + run: gh auth login --with-token + + - name: Fetch Latest Successful Docs Deploy Run ID + id: fetch_run + run: | + latest_run_id=$(gh run list --repo telerik/blazor --workflow docs-builder-manual.yml --json databaseId,status,conclusion --jq '.[] | select(.status == "completed" and .conclusion == "success") | .databaseId' | head -n 1) + echo "Latest successful run ID: $latest_run_id" + echo "latest_docs_deploy_run_id=$latest_run_id" >> $GITHUB_ENV + + - name: Download API Metadata + uses: actions/download-artifact@v4.1.7 with: name: metadata - retention-days: 2 - path: .\metadata.zip - - build-docs: - needs: extract-metadata - runs-on: ubuntu-latest - permissions: - id-token: write # Required by Akeyless - contents: write - steps: - - name: Import Secrets - id: import-secrets - uses: LanceMcCarthy/akeyless-action@v3 - with: - access-id: ${{ secrets.GH_AKEYLESS_ACCESS_ID }} - static-secrets: | - { - "/WebComponents/prod/tokens/GH_TOKEN": "GH_TOKEN" - } - export-secrets-to-environment: false + github-token: ${{ steps.import-secrets.outputs.GH_TOKEN }} + repository: telerik/blazor + run-id: ${{ steps.fetch_run.outputs.latest_docs_deploy_run_id }} + + - name: Extract API Metadata + run: 7z x ./metadata/metadata.zip -ometadata - - name: Check out Blazor-Docs repo + - name: Checkout blazor-docs Repository uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} token: ${{ steps.import-secrets.outputs.GH_TOKEN }} fetch-depth: "0" - - name: Download Api Metadata - uses: actions/download-artifact@v4.1.7 - with: - name: metadata - path: metadata - - - name: Extract Api Metadata - run: 7z x ./metadata/metadata.zip -ometadata - - - name: Check out docs builder repository + - name: Checkout docs-builder Repository uses: actions/checkout@v4 with: repository: telerik/docs-builder @@ -187,7 +69,7 @@ jobs: path: docs-builder token: ${{ steps.import-secrets.outputs.GH_TOKEN }} - - name: install packages + - name: Install NPM Packages run: npm ci working-directory: docs-builder