docs(repo): note bin field pitfall for npm CLI 11.17+ publish #2911
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: | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| schedule: | |
| - cron: "0 17 * * 1-5" # UTC 17:00 = JST 02:00, weekdays | |
| workflow_dispatch: | |
| inputs: | |
| full_matrix: | |
| description: "Run build-test on the full multi-OS matrix (like nightly)" | |
| type: boolean | |
| default: false | |
| concurrency: | |
| group: test-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| code: ${{ steps.filter.outputs.code }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Detect docs-only changes | |
| id: filter | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| with: | |
| filters: | | |
| code: | |
| - '!**/*.md' | |
| - '!LICENSE' | |
| - '!.github/ISSUE_TEMPLATE/**' | |
| - '!.github/CODEOWNERS' | |
| - '!.claude/**' | |
| - '!.cursor/**' | |
| - '!.vscode/**' | |
| setup-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set.outputs.matrix }} | |
| steps: | |
| - name: Compute OS matrix | |
| id: set | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event.inputs.full_matrix }}" = "true" ]; then | |
| echo 'matrix={"os":["ubuntu-latest","macOS-latest","windows-latest"]}' >> "$GITHUB_OUTPUT" | |
| else | |
| echo 'matrix={"os":["ubuntu-latest"]}' >> "$GITHUB_OUTPUT" | |
| fi | |
| lint: | |
| needs: [changes] | |
| if: needs.changes.outputs.code == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: 24 | |
| - name: Enable Corepack and setup Yarn v4 | |
| run: | | |
| corepack enable | |
| yarn --version | |
| - name: Cache dependencies | |
| id: cache-depends | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 | |
| with: | |
| path: "**/node_modules" | |
| key: os-ubuntu-latest-node24-${{ hashFiles('yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-depends.outputs.cache-hit != 'true' | |
| run: yarn install --immutable | |
| - name: Lint | |
| run: yarn lint | |
| build-test: | |
| needs: [changes, setup-matrix, lint] | |
| if: needs.changes.outputs.code == 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: 24 | |
| - name: Enable Corepack and setup Yarn v4 | |
| run: | | |
| corepack enable | |
| yarn --version | |
| - name: Cache dependencies | |
| id: cache-depends | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 | |
| with: | |
| path: "**/node_modules" | |
| key: os-${{ matrix.os }}-node24-${{ hashFiles('yarn.lock') }} | |
| - name: Create .yarnrc for Windows | |
| if: runner.os == 'Windows' && steps.cache-depends.outputs.cache-hit != 'true' | |
| run: echo "network-timeout 600000" > .yarnrc | |
| - name: Install dependencies | |
| if: steps.cache-depends.outputs.cache-hit != 'true' | |
| run: yarn install --immutable | |
| - name: Build | |
| run: yarn build | |
| - name: Test | |
| run: yarn test | |
| ci-required: | |
| needs: [changes, lint, build-test] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Aggregate job results | |
| shell: bash | |
| env: | |
| NEEDS: ${{ toJSON(needs) }} | |
| run: | | |
| echo "$NEEDS" | |
| failed=$(echo "$NEEDS" | jq -r 'to_entries[] | select(.value.result == "failure" or .value.result == "cancelled") | .key') | |
| if [ -n "$failed" ]; then | |
| echo "Failed jobs: $failed" | |
| exit 1 | |
| fi | |
| nightly-report: | |
| needs: [build-test] | |
| if: failure() && github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Ensure ci-failure label | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh label create ci-failure --color d73a4a --description "Nightly CI failure" --force | |
| - name: Open or update failure issue | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MARKER: "[nightly-ci-failure]" | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| shell: bash | |
| run: | | |
| existing=$(gh issue list --search "in:title $MARKER" --state open --json number --jq '.[0].number' || echo "") | |
| title="$MARKER Nightly CI failure ($(date -u +%Y-%m-%d))" | |
| body="Nightly build-test failed. See: $RUN_URL" | |
| if [ -n "$existing" ]; then | |
| gh issue comment "$existing" --body "$body" | |
| else | |
| gh issue create --title "$title" --body "$body" --label "ci-failure" | |
| fi |