name: Publish Docs on: workflow_dispatch: inputs: ref: description: 'Git ref (tag, branch, or commit SHA) to build docs from' required: true type: string workflow_call: inputs: ref: description: 'Git ref (tag, branch, or commit SHA) to build docs from' required: true type: string jobs: publish-docs: runs-on: ubuntu-latest environment: Release steps: - name: Create GitHub App Token uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3 id: generate_token with: app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} owner: ${{ github.repository_owner }} repositories: icp-js-sdk-docs - name: Checkout source at ref uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ inputs.ref }} - name: Setup PNPM uses: dfinity/ci-tools/actions/setup-pnpm@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main - uses: dfinity/ci-tools/actions/extract-version@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main id: extract-version with: file: 'packages/core/package.json' - name: Prepare version id: ver run: | echo "major_minor_version=v${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}" >> $GITHUB_OUTPUT echo "major_minor_patch_version=v${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.${{ steps.extract-version.outputs.patch }}" >> $GITHUB_OUTPUT - name: Build docs for version ${{ steps.ver.outputs.major_minor_version }} working-directory: docs env: DOCS_VERSION: ${{ steps.ver.outputs.major_minor_version }} run: pnpm build - name: Build docs for version latest working-directory: docs env: DOCS_VERSION: latest run: pnpm build - name: Checkout icp-pages branch uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: icp-pages path: icp-pages - name: Assemble docs uses: dfinity/ci-tools/actions/assemble-docs@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main with: assets_dir: 'docs/dist/${{ steps.ver.outputs.major_minor_version }}' version: ${{ steps.ver.outputs.major_minor_version }} target_dir: 'icp-pages' version_label: ${{ steps.ver.outputs.major_minor_version }} version_in_title: ${{ steps.ver.outputs.major_minor_patch_version }} - name: Assemble docs uses: dfinity/ci-tools/actions/assemble-docs@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main with: assets_dir: 'docs/dist/latest' version: 'latest' target_dir: 'icp-pages' version_label: 'Latest (${{ steps.ver.outputs.major_minor_patch_version }})' - name: Submit Documentation uses: dfinity/ci-tools/actions/submit-docs@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main with: destination_repo: 'dfinity/icp-js-sdk-docs' token: ${{ steps.generate_token.outputs.token }} target_dir: 'icp-pages'