WIP #2200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow handles CI (build/test) for all PRs and pushes to main, | |
| # as well as npm publishing for @launchdarkly and @highlight-run packages. | |
| # | |
| # AUTOMATED PUBLISHING (on push to main): | |
| # - Publishes @highlight-run/* and highlight.run packages using NPM token | |
| # - Publishes @launchdarkly/* packages using OIDC authentication | |
| # | |
| # MANUAL PUBLISHING (via workflow_dispatch): | |
| # - Can be triggered manually from the Actions tab | |
| # - Supports prerelease and dry-run modes for @launchdarkly/* packages | |
| # - OIDC requires a single workflow per npm package, so manual publishing | |
| # is consolidated here rather than in a separate workflow | |
| name: Monorepo | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| types: [opened, synchronize] | |
| workflow_dispatch: | |
| inputs: | |
| dry-run: | |
| description: 'Is this a dry run. If so no package will be published.' | |
| type: boolean | |
| required: true | |
| prerelease: | |
| description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.' | |
| type: boolean | |
| required: true | |
| permissions: | |
| id-token: write | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| issues: read | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| yarn-monorepo: | |
| name: Build Yarn Turborepo | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-22.04-8core-32gb | |
| # configures turborepo Remote Caching | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - run: git submodule update --init --recursive | |
| # automatically caches dependencies based on yarn.lock | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: 'yarn' | |
| - name: Install js dependencies | |
| run: yarn install | |
| - name: Check yarn for duplicate deps | |
| run: yarn dedupe --check | |
| - name: Check formatting | |
| run: yarn format-check | |
| - name: Build & test (in a fork without doppler) | |
| run: yarn test | |
| env: | |
| NEXT_PUBLIC_HIGHLIGHT_PROJECT_ID: 1jdkoe52 | |
| REACT_APP_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Configure yarn npm registry credentials | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| yarn config set npmRegistryServer "https://registry.npmjs.org" | |
| yarn config set npmAuthToken "${NPM_TOKEN}" | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN_HIGHLIGHT_RUN }} | |
| - name: Publish highlight npm packages | |
| if: github.ref == 'refs/heads/main' | |
| run: yarn publish:highlight | |
| # Publishing credentials for @launchdarkly/* NPM packages come from OIDC. | |
| - name: Setup Node.js for OIDC publishing | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| uses: ./.github/actions/setup-release-node | |
| - name: Publish @launchdarkly npm packages | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| shell: bash | |
| run: ./scripts/publish-npm.sh | |
| env: | |
| LD_RELEASE_IS_PRERELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.prerelease || false }} | |
| LD_RELEASE_IS_DRYRUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run || false }} |