|
| 1 | +name: Docs Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +permissions: |
| 7 | + id-token: write # Required by Akeyless |
| 8 | + contents: write |
| 9 | + packages: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + build_blazor: |
| 13 | + runs-on: ubuntu-22.04 |
| 14 | + |
| 15 | + container: |
| 16 | + image: ghcr.io/telerik/blazor-build:dev |
| 17 | + credentials: |
| 18 | + username: ${{ github.actor }} |
| 19 | + password: ${{ github.token }} |
| 20 | + options: --user 1001 --shm-size="8g" |
| 21 | + |
| 22 | + env: |
| 23 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 24 | + DOTNET_INSTALL_DIR: ./.dotnet |
| 25 | + SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt |
| 26 | + |
| 27 | + defaults: |
| 28 | + run: |
| 29 | + # Use a login Bash shell to enable RVM |
| 30 | + shell: bash -leo pipefail {0} |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Import Secrets |
| 34 | + id: import-secrets |
| 35 | + uses: LanceMcCarthy/akeyless-action@v3 |
| 36 | + with: |
| 37 | + access-id: ${{ secrets.GH_AKEYLESS_ACCESS_ID }} |
| 38 | + static-secrets: | |
| 39 | + { |
| 40 | + "/WebComponents/prod/tokens/GH_TOKEN": "GH_TOKEN" |
| 41 | + } |
| 42 | + export-secrets-to-environment: false |
| 43 | + |
| 44 | + - name: Clone Blazor Repository |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + repository: telerik/blazor |
| 48 | + path: temp/blazor |
| 49 | + fetch-depth: "0" |
| 50 | + ref: master |
| 51 | + |
| 52 | + - name: Setup .NET |
| 53 | + uses: actions/setup-dotnet@v4 |
| 54 | + with: |
| 55 | + dotnet-version: "6.x.x" |
| 56 | + |
| 57 | + - name: Setup Telerik Nuget Feeds |
| 58 | + uses: telerik/actions/setup-telerik-nuget-feeds@master |
| 59 | + with: |
| 60 | + ak-vault-token: ${{ secrets.AK_VAULT_TOKEN_PACKAGE_READER }} |
| 61 | + |
| 62 | + - name: Pack Telerik.Blazor and copy docs API needed resources |
| 63 | + run: | |
| 64 | + mkdir -p BinAndXml |
| 65 | + dotnet pack blazor/Telerik.Blazor/Telerik.Blazor.csproj --configuration Release -p:IsTrial='false' |
| 66 | + cp blazor/Telerik.Blazor/bin/Release/net6.0/Telerik.Blazor.dll BinAndXml |
| 67 | + cp blazor/Telerik.Blazor/bin/Release/net6.0/Telerik.Blazor.xml BinAndXml |
| 68 | + ls BinAndXml |
| 69 | + working-directory: temp |
| 70 | + |
| 71 | + - name: Get DataSource bin and xml files |
| 72 | + uses: telerik/actions/get-release-assets@master |
| 73 | + with: |
| 74 | + repo: telerik-datasource |
| 75 | + pattern: debug-assets.zip |
| 76 | + dir: temp/datasource |
| 77 | + token: ${{ steps.import-secrets.outputs.GH_TOKEN }} |
| 78 | + unzip: true |
| 79 | + verify-attestation: true |
| 80 | + |
| 81 | + - name: Move DataSource bin and xml to BinAndXml folder |
| 82 | + run: | |
| 83 | + cp datasource/net6.0/Telerik.DataSource.dll BinAndXml |
| 84 | + cp datasource/net6.0/Telerik.DataSource.xml BinAndXml |
| 85 | + ls BinAndXml |
| 86 | + working-directory: temp |
| 87 | + |
| 88 | + - name: Upload BinAndXml folder artifacts |
| 89 | + |
| 90 | + with: |
| 91 | + name: BinAndXml |
| 92 | + retention-days: 2 |
| 93 | + path: temp/BinAndXml |
| 94 | + |
| 95 | + extract-metadata: |
| 96 | + runs-on: windows-latest |
| 97 | + needs: build_blazor |
| 98 | + permissions: |
| 99 | + id-token: write # Required by Akeyless |
| 100 | + contents: write |
| 101 | + steps: |
| 102 | + - name: Import Secrets |
| 103 | + id: import-secrets |
| 104 | + uses: LanceMcCarthy/akeyless-action@v3 |
| 105 | + with: |
| 106 | + access-id: ${{ secrets.GH_AKEYLESS_ACCESS_ID }} |
| 107 | + static-secrets: | |
| 108 | + { |
| 109 | + "/WebComponents/prod/tokens/GH_TOKEN": "GH_TOKEN" |
| 110 | + } |
| 111 | + export-secrets-to-environment: false |
| 112 | + |
| 113 | + - name: Check out Blazor-Docs repo |
| 114 | + uses: actions/checkout@v4 |
| 115 | + with: |
| 116 | + sparse-checkout: _assetsApi |
| 117 | + ref: ${{ github.ref_name }} |
| 118 | + token: ${{ steps.import-secrets.outputs.GH_TOKEN }} |
| 119 | + fetch-depth: "0" |
| 120 | + |
| 121 | + - name: Download Binaries |
| 122 | + |
| 123 | + with: |
| 124 | + name: BinAndXml |
| 125 | + path: src |
| 126 | + |
| 127 | + - name: Copy docfx config files |
| 128 | + run: | |
| 129 | + copy .\_assetsApi\filterConfig.yml .\filterConfig.yml |
| 130 | + copy .\_assetsApi\metadata-config.json .\metadata-config.json |
| 131 | +
|
| 132 | + - name: Install docfx |
| 133 | + run: dotnet tool update -g docfx |
| 134 | + |
| 135 | + - name: Generate metadata |
| 136 | + run: docfx metadata-config.json |
| 137 | + |
| 138 | + - name: Zip metadata |
| 139 | + run: 7z a metadata.zip .\metadata\* |
| 140 | + |
| 141 | + - name: Upload metadata artifacts |
| 142 | + |
| 143 | + with: |
| 144 | + name: metadata |
| 145 | + retention-days: 2 |
| 146 | + path: .\metadata.zip |
| 147 | + |
| 148 | + build-docs: |
| 149 | + needs: extract-metadata |
| 150 | + runs-on: ubuntu-latest |
| 151 | + permissions: |
| 152 | + id-token: write # Required by Akeyless |
| 153 | + contents: write |
| 154 | + steps: |
| 155 | + - name: Import Secrets |
| 156 | + id: import-secrets |
| 157 | + uses: LanceMcCarthy/akeyless-action@v3 |
| 158 | + with: |
| 159 | + access-id: ${{ secrets.GH_AKEYLESS_ACCESS_ID }} |
| 160 | + static-secrets: | |
| 161 | + { |
| 162 | + "/WebComponents/prod/tokens/GH_TOKEN": "GH_TOKEN" |
| 163 | + } |
| 164 | + export-secrets-to-environment: false |
| 165 | + |
| 166 | + - name: Check out Blazor-Docs repo |
| 167 | + uses: actions/checkout@v4 |
| 168 | + with: |
| 169 | + ref: ${{ github.ref_name }} |
| 170 | + token: ${{ steps.import-secrets.outputs.GH_TOKEN }} |
| 171 | + fetch-depth: "0" |
| 172 | + |
| 173 | + - name: Download Api Metadata |
| 174 | + |
| 175 | + with: |
| 176 | + name: metadata |
| 177 | + path: metadata |
| 178 | + |
| 179 | + - name: Extract Api Metadata |
| 180 | + run: 7z x ./metadata/metadata.zip -ometadata |
| 181 | + |
| 182 | + - name: Check out docs builder repository |
| 183 | + uses: actions/checkout@v4 |
| 184 | + with: |
| 185 | + repository: telerik/docs-builder |
| 186 | + ref: master |
| 187 | + path: docs-builder |
| 188 | + token: ${{ steps.import-secrets.outputs.GH_TOKEN }} |
| 189 | + |
| 190 | + - name: install packages |
| 191 | + run: npm ci |
| 192 | + working-directory: docs-builder |
| 193 | + |
| 194 | + - name: Build Content |
| 195 | + run: npm run prod-build --docsPath=../blazor-docs --docfxFilesPath=../metadata |
| 196 | + working-directory: docs-builder |
0 commit comments