Skip to content

semantic-release does not run when corepack downloads npm version #258

@LuisWolf-Snapaddy

Description

@LuisWolf-Snapaddy

Describe the bug

When using corepack inside GitHub Actions this action will automatically download the required npm version.

If your project uses the same npm version as semantic-release this is not a problem. The project install will first download the requested npm version and install dependencies. Semantic-release will then also use this version.

But if your project is using a different npm version, semantic-release will also try to install its version on top and not continue with the actual release logic.

With different npm version With same npm version
Image Image

Workflow

Example workflow file
name: Publish new version

on:
  push:
    branches:
      - master

jobs:
  test-unit:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
      issues: write
      pull-requests: write
      packages: read

    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc
          cache: 'npm'

      - name: Enable Corepack
        run: corepack enable && corepack enable npm

      - name: Install dependencies
        run: npm ci

      - name: Semantic Release
        id: semrelease
        uses: cycjimmy/semantic-release-action@v4
        with:
          semantic_version: 24
          extra_plugins: |
            @semantic-release/changelog
            @semantic-release/exec
            @semantic-release/git
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expected behavior

I don't really care which npm version semantic-release uses in the end to run it's logic, but it should do it even with the separate download

Additional context

My workaround was to just update the npm version to the same one, so the install runs before semantic-release starts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions