fix(platform): make the yalc development loop install dependencies #1554
Workflow file for this run
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
| name: Test | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags: ["**"] | |
| pull_request: | |
| # The branches below should be a subset of the branches above | |
| branches: ["main"] | |
| workflow_dispatch: | |
| inputs: | |
| # Allow debugging a GHA build agent. This is the trigger. See the last step. | |
| debug_enabled: | |
| type: boolean | |
| description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
| required: false | |
| default: false | |
| # env: | |
| # Temporarily disabled while Nx Cloud credits are exhausted. IJH: 2026 Feb 16 | |
| # NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
| # Needed for nx-set-shas when run on the main branch | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: read | |
| # Required for npm provenance | |
| id-token: write | |
| jobs: | |
| test: | |
| name: Build on ${{ matrix.os }}, node ${{ matrix.node_version }}, PNPM ${{ matrix.pnpm_version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| node_version: [20] | |
| pnpm_version: [10] | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install PNPM | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: ${{ matrix.pnpm_version }} | |
| - name: Install Node.js and npm | |
| uses: actions/setup-node@v4 | |
| with: | |
| registry-url: "https://registry.npmjs.org" | |
| node-version: ${{ matrix.node_version }} | |
| cache: pnpm | |
| - name: Verify and upgrade npm (Trusted Publishing requires npm >= 11.5.1) | |
| run: | | |
| echo "npm before upgrade:" | |
| npm --version | |
| npm i -g npm@^11.5.1 | |
| echo "npm after upgrade:" | |
| npm --version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@v4 | |
| - name: Check formatting | |
| run: | | |
| pnpm prettier --check . | |
| pnpm nx format:check | |
| - name: Check linting | |
| run: pnpm nx affected -t lint | |
| - name: Check types | |
| run: pnpm nx affected -t typecheck | |
| - name: Check tests | |
| run: pnpm nx affected -t test | |
| - name: Production build | |
| run: pnpm nx affected -t build | |
| - name: Test yalc consumer | |
| if: matrix.os == 'ubuntu-latest' | |
| run: pnpm nx test-yalc platform-editor | |
| # With help from https://stackoverflow.com/questions/75357158/github-actions-npm-publish-fails-with-err-code-eneedauth | |
| - name: pnpm publish platform-editor | |
| if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/platform_v') && contains(github.ref, '.') }} | |
| shell: bash | |
| run: | | |
| cd ./packages/platform | |
| pnpm publish --no-git-checks | |
| - name: pnpm publish scribe-editor | |
| if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/scribe_v') && contains(github.ref, '.') }} | |
| shell: bash | |
| run: | | |
| cd ./packages/scribe | |
| pnpm publish --no-git-checks --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: npm publish scripture-utilities | |
| if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/utilities_v') && contains(github.ref, '.') }} | |
| shell: bash | |
| run: | | |
| cd ./packages/utilities | |
| pnpm publish --no-git-checks | |
| # Enable tmate debugging of manually-triggered workflows if the input option was provided | |
| - name: Setup tmate session | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |
| # Bumping `main` to the next version is a consequence of publishing platform-editor, not a | |
| # separate step to remember: until it happens `main` still advertises the version npm now has, | |
| # and the next tag push fails trying to republish it. | |
| bump-platform-version: | |
| name: Open platform-editor version bump PR | |
| needs: test | |
| # Mirrors the `pnpm publish platform-editor` step's condition. `needs: test` means a failed or | |
| # skipped publish never reaches this job. | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/platform_v') && contains(github.ref, '.') }} | |
| runs-on: ubuntu-latest | |
| # Scoped to this job so the test matrix keeps the read-only token declared at workflow level. | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Check out main | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Bump to the next patch version | |
| id: bump | |
| shell: bash | |
| run: | | |
| published="${GITHUB_REF_NAME#platform_v}" | |
| current="$(node -p "require('./packages/platform/package.json').version")" | |
| # Only bump when `main` still advertises the version we just published. If someone already | |
| # bumped it, or the tag lags `main`, leave it alone rather than guessing. | |
| if [ "$current" != "$published" ]; then | |
| echo "main is at $current but $published was published; skipping bump." >> "$GITHUB_STEP_SUMMARY" | |
| echo "skipped=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| cd ./packages/platform | |
| next="$(npm version patch --no-git-tag-version)" | |
| next="${next#v}" | |
| cd ../.. | |
| echo "next=$next" >> "$GITHUB_OUTPUT" | |
| echo "branch=chore/bump-platform-editor-$next" >> "$GITHUB_OUTPUT" | |
| echo "skipped=false" >> "$GITHUB_OUTPUT" | |
| - name: Open the pull request | |
| if: ${{ steps.bump.outputs.skipped == 'false' }} | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NEXT: ${{ steps.bump.outputs.next }} | |
| BRANCH: ${{ steps.bump.outputs.branch }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b "$BRANCH" | |
| git add packages/platform/package.json | |
| git commit -m "platform: bump version for next release" | |
| git push origin "$BRANCH" | |
| gh pr create \ | |
| --base main \ | |
| --head "$BRANCH" \ | |
| --title "platform: bump version to $NEXT for next release" \ | |
| --body "$(cat <<EOF | |
| Opened automatically after \`$GITHUB_REF_NAME\` published \`@eten-tech-foundation/platform-editor\` to npm. | |
| Bumps \`packages/platform/package.json\` so the next release has an unclaimed version to tag. | |
| Note: PRs opened with \`GITHUB_TOKEN\` do not trigger workflow runs. Close and reopen this PR, | |
| or push an empty commit, if a Test run is needed before merging. | |
| Automated by \`.github/workflows/test-publish.yml\`. | |
| EOF | |
| )" |