ci: update publish workflow to use scribe-v2 tag for non-main branche… #683
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 | |
| 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: [9] | |
| 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: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check formatting | |
| run: | | |
| pnpm prettier --check . | |
| pnpm nx format:check | |
| - name: Check linting | |
| run: pnpm nx run-many -t lint | |
| - name: Check types | |
| run: pnpm nx run-many -t typecheck | |
| - name: Check tests | |
| run: pnpm nx run-many -t test | |
| - name: Production build | |
| run: pnpm nx run-many -t build | |
| # With help from https://stackoverflow.com/questions/75357158/github-actions-npm-publish-fails-with-err-code-eneedauth | |
| - name: pnpm publish platform | |
| 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 --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: pnpm publish scribe | |
| 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 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 --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # 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 |