|
9 | 9 |
|
10 | 10 | env: |
11 | 11 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
12 | | - IS_OFFICIAL_REPO: ${{ github.repository == 'temporalio/sdk-typescript' }} |
13 | 12 | # Is it the official main branch, or an official release branches? |
| 13 | + # |
| 14 | + # Variable IS_TEMPORALIO_SDK_TYPESCRIPT_REPO is configured to true on the official repo. |
| 15 | + # It can be used to determine if the present execution has access to secrets or not. |
| 16 | + # |
14 | 17 | # AFAIK there's no way to break that line w/o introducing a trailing LF that breaks usage. Sorry. |
15 | | - IS_MAIN_OR_RELEASE: ${{ github.repository == 'temporalio/sdk-typescript' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/releases')) && github.event_name != 'pull_request' }} |
| 18 | + IS_MAIN_OR_RELEASE: ${{ vars.IS_TEMPORALIO_SDK_TYPESCRIPT_REPO == 'true' && github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/releases')) }} |
16 | 19 |
|
17 | 20 | # Use these variables to force specific version of CLI/Time Skipping Server for SDK tests |
18 | 21 | # TESTS_CLI_VERSION: 'v0.13.2' |
@@ -448,123 +451,12 @@ jobs: |
448 | 451 | test-timeout-minutes: 20 |
449 | 452 | reuse-v8-context: true |
450 | 453 |
|
451 | | - # Run TS linting and ts-prune to find unused code |
452 | | - lint-and-prune: |
453 | | - name: Lint and Prune |
454 | | - strategy: |
455 | | - # Using a matrix here ensure that Rust-related actions below can be easily be copied from the |
456 | | - # compile-binairies job and that the Rust build cache will be usable |
457 | | - matrix: |
458 | | - include: |
459 | | - - platform: linux-x64 |
460 | | - runner: ubuntu-latest-4-cores |
461 | | - target: x86_64-unknown-linux-gnu |
462 | | - runs-on: ${{ matrix.runner }} |
463 | | - steps: |
464 | | - - name: Checkout code |
465 | | - uses: actions/checkout@v4 |
466 | | - with: |
467 | | - submodules: recursive |
468 | | - |
469 | | - - name: Install Node |
470 | | - uses: actions/setup-node@v4 |
471 | | - with: |
472 | | - node-version: 20 |
473 | | - |
474 | | - - name: Get NPM cache directory |
475 | | - id: npm-cache-dir |
476 | | - shell: bash |
477 | | - run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} |
478 | | - |
479 | | - - name: Restore NPM cache |
480 | | - uses: actions/cache/restore@v4 |
481 | | - with: |
482 | | - path: ${{ steps.npm-cache-dir.outputs.dir }} |
483 | | - key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }} |
484 | | - restore-keys: | |
485 | | - npm-main-${{ matrix.platform }}- |
486 | | -
|
487 | | - - name: Install Rust |
488 | | - uses: dtolnay/rust-toolchain@stable |
489 | | - with: |
490 | | - target: ${{ matrix.target }} |
491 | | - |
492 | | - - name: Install protoc |
493 | | - uses: arduino/setup-protoc@v3 |
494 | | - with: |
495 | | - # TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed |
496 | | - version: '23.x' |
497 | | - repo-token: ${{ secrets.GITHUB_TOKEN }} |
498 | | - |
499 | | - - name: Rust Cargo and Build cache |
500 | | - uses: Swatinem/rust-cache@v2 |
501 | | - with: |
502 | | - workspaces: packages/core-bridge -> target |
503 | | - prefix-key: corebridge-buildcache |
504 | | - shared-key: ${{ matrix.platform }} |
505 | | - env-vars: '' |
506 | | - save-if: false |
507 | | - |
508 | | - - name: Download dependencies |
509 | | - run: | |
510 | | - npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose |
511 | | -
|
512 | | - # eslint-import-resolver-typescript requires packages to be built |
513 | | - - name: Compile all non-rust code |
514 | | - run: npm run build -- --ignore @temporalio/core-bridge |
515 | | - |
516 | | - - run: npm run lint.check |
517 | | - - run: npm run lint.prune |
518 | | - |
519 | | - build-docs: |
| 454 | + docs: |
520 | 455 | name: Build Docs |
521 | | - strategy: |
522 | | - # Using a matrix here ensure that Rust-related actions below can be easily be copied from the |
523 | | - # compile-binairies job and that the Rust build cache will be usable |
524 | | - matrix: |
525 | | - include: |
526 | | - - platform: linux-x64 |
527 | | - runner: ubuntu-latest-4-cores |
528 | | - target: x86_64-unknown-linux-gnu |
529 | | - runs-on: ${{ matrix.runner }} |
530 | | - steps: |
531 | | - - name: Checkout code |
532 | | - uses: actions/checkout@v4 |
533 | | - with: |
534 | | - submodules: recursive |
535 | | - |
536 | | - - name: Install Node |
537 | | - uses: actions/setup-node@v4 |
538 | | - with: |
539 | | - node-version: 20 |
540 | | - |
541 | | - - name: Get NPM cache directory |
542 | | - id: npm-cache-dir |
543 | | - shell: bash |
544 | | - run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} |
545 | | - |
546 | | - - name: Restore NPM cache |
547 | | - uses: actions/cache/restore@v4 |
548 | | - with: |
549 | | - path: ${{ steps.npm-cache-dir.outputs.dir }} |
550 | | - key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }} |
551 | | - restore-keys: | |
552 | | - npm-main-${{ matrix.platform }}- |
553 | | -
|
554 | | - # Don't build during install phase since we're going to explicitly build |
555 | | - - name: Download dependencies |
556 | | - # Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors |
557 | | - run: | |
558 | | - npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose |
559 | | -
|
560 | | - - run: npm run build -- --ignore @temporalio/core-bridge |
561 | | - |
562 | | - - name: Build docs |
563 | | - run: npm run docs |
564 | | - env: |
565 | | - ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} |
566 | | - |
567 | | - - name: Deploy draft docs |
568 | | - # Can't run on forks, since secrets won't be available, and command will fail |
569 | | - if: ${{ env.IS_OFFICIAL_REPO == 'true'}} |
570 | | - run: npx vercel deploy packages/docs/build -t ${{ secrets.VERCEL_TOKEN }} --name typescript --scope temporal --yes |
| 456 | + uses: ./.github/workflows/docs.yml |
| 457 | + with: |
| 458 | + # Can't publish from forks, as secrets won't be available |
| 459 | + publish_target: ${{ vars.IS_TEMPORALIO_SDK_TYPESCRIPT_REPO == 'true' && 'draft' || '' }} |
| 460 | + secrets: |
| 461 | + ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} |
| 462 | + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
0 commit comments