Toan Lam
Toan Lam

Reputation: 139

Publish Storybook components to NPM using Semantic Release and Github Actions

Article for reference

I can set up Github Actions but get stuck on GitHub Release; it says

Run npx semantic-release [semantic-release]: node version >=16 || ^14.17 is required. Found v12.22.12.

See https://github.com/semantic-release/semantic-release/blob/master/docs/support/node-version.md for more details and solutions. Error: Process completed with exit code 1.

It says I'm using an older version of Node. However, it's not possible. Both my package.json and node -v says it is 16.x.x.

What could be wrong?

Upvotes: 0

Views: 171

Answers (1)

Killerz0ne
Killerz0ne

Reputation: 344

My working step is:

build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ secrets.ADMIN_TOKEN }}

      - name: setup nodejs
        uses: actions/setup-node@v3
        with:
          node-version: '16'

      - name: release using semantic-release
        env:
          GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
          GIT_AUTHOR_NAME: secrets.automation.dev
          GIT_AUTHOR_EMAIL: [email protected]
          GIT_COMMITTER_NAME: secrets.automation.dev
          GIT_COMMITTER_EMAIL: [email protected]
        run: |
          sudo apt-get update
          sudo apt-get install python
          pip install --user bumpversion
          npm install @semantic-release/changelog
          npm install @semantic-release/exec
          npm install @semantic-release/git
          npm install @semantic-release/github
          npx semantic-release

the .releaserc file is:

{
  "debug": true,
  "branches": [ "main" ],
  "plugins": [
    ["@semantic-release/commit-analyzer", {
        "preset": "angular",
        "releaseRules": [
            {"type": "release","release": "patch"}
    ]}],
    "@semantic-release/release-notes-generator",
    "@semantic-release/changelog",
    [
      "@semantic-release/exec",
      {
        "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch"
      }
    ],
    [
      "@semantic-release/git",
      {
        "message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}"
      }
    ],
    "@semantic-release/github"
  ]
}

Upvotes: 0

Related Questions