cycjimmy / semantic-release-action

GitHub Action for Semantic Release
https://github.com/marketplace/actions/action-for-semantic-release
MIT License
550 stars 98 forks source link

Incompatibility with semantic-release >v20 #168

Closed carlobernardini closed 1 year ago

carlobernardini commented 1 year ago

Describe the bug Semantic release only supports esm as of v20. This action, however, still imports semantic-release using cjs. As a consequence, it cannot use the latest major versions that are esm-only.

Workflow For example:

   - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        with:
          semantic_version: 21
          extra_plugins: semantic-release-slack-bot@4.0.2
        env:
          SLACK_WEBHOOK: ***
          GH_TOKEN: ***
          NPM_TOKEN: ***

Additional context The resulting error in the CI output:

Error: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/index.js from /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/src/index.js not supported.
Instead change the require of /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/index.js in /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/src/index.js to a dynamic import() which is available in all CommonJS modules.
shakefu commented 1 year ago

Any chance this will be fixed? Otherwise we'll need to migrate away from this action... (Also thank you for your work and OSS contributions!) /cc @cycjimmy

MikeMcC399 commented 1 year ago

See:

GitHub prerequisite:

enell commented 1 year ago

Node20 is being rolled out. In created a pr for testing it

https://github.com/actions/runner/issues/2619#issuecomment-1679003443

erzz commented 1 year ago

As of the last few days releases are silently failing on the commit analyzer and this seems to tie in with the work that plugin is doing in supporting the ESM stuff in the last few days.

This feels a bit urgent now! Unfortunately there doesnt seem to be a way via the action of pinning the preinstalled plugins back to previous versions either

e.g.

extra_plugins: |
    @semantic-release/commit-analyzer@v10.0.1

fails (and as the action is using --silent i cant see the exact error)

dmitrii-didenko commented 1 year ago

@erzz all of my workflows are ending on the following string: Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer" and it doesn't go any further. Do you see the same on your side?

BrendanGalloway commented 1 year ago

@dmitrii-didenko Try:

      - uses: cycjimmy/semantic-release-action@v3
        with:
          semantic_version: 19.0.5
          extra_plugins: |
            @semantic-release/commit-analyzer@9.0.2
            @semantic-release/release-notes-generator@10.0.3
            @semantic-release/npm@9.0.2
            @semantic-release/github@8.0.7
            @semantic-release/git@10.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Those version are working for us

erzz commented 1 year ago

@erzz all of my workflows are ending on the following string: Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer" and it doesn't go any further. Do you see the same on your side?

Correct.

@dmitrii-didenko Try:

      - uses: cycjimmy/semantic-release-action@v3
        with:
          semantic_version: 19.0.5
          extra_plugins: |
            @semantic-release/commit-analyzer@9.0.2
            @semantic-release/release-notes-generator@10.0.3
            @semantic-release/npm@9.0.2
            @semantic-release/github@8.0.7
            @semantic-release/git@10.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Those version are working for us

Just tried that and same result unfortunately

- name: Semantic Release
  id: semantic-release
  uses: cycjimmy/semantic-release-action@v3
   env:
      GITHUB_TOKEN: ${{ secrets.token }}
    with:
      semantic_version: v19.0.5
      branches: ${{ inputs.branches }}
      dry_run: ${{ inputs.dry-run }}
      extra_plugins: |
        @semantic-release/commit-analyzer@9.0.2
        @semantic-release/release-notes-generator@10.0.3
        @semantic-release/npm@9.0.2
        @semantic-release/github@8.0.7
        @semantic-release/git@10.0.1
        @semantic-release/changelog
        conventional-changelog-conventionalcommits
        @semantic-release/exec
[11:49:00 AM] [semantic-release] › ℹ  Running semantic-release version 19.0.5
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[11:49:01 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[11:49:04 AM] [semantic-release] › ⚠  Run automated release from branch rel-test on repository https://github.com/my-org/my-repo in dry-run mode
[11:49:04 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[11:49:04 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/changelog"
[11:49:04 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[11:49:04 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[11:49:04 AM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication (https://api.github.com/)
[11:49:04 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[11:49:04 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/git"
[11:49:04 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/git"
[11:49:04 AM] [semantic-release] › ℹ  Found git tag v2.2.0 associated with version 2.2.0 on branch rel-test
[11:49:04 AM] [semantic-release] › ℹ  Found 9 commits since last release
[11:49:04 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
BrendanGalloway commented 1 year ago

@erzz for conventional-changelog-conventionalcommits try conventional-changelog-conventionalcommits@6.1.0. You will likely need to pin @semantic-release/changelog and @semantic-release/exec to older versions too

dmitrii-didenko commented 1 year ago

@BrendanGalloway it works. you've saved my day. Thank you!

erzz commented 1 year ago

Wow @BrendanGalloway - what a ⭐ you are :)

Yes the final tweak of conventional-changelog-conventionalcommits@6.1.0 got it working again

Huge thankyou for taking the time to help! Seems like the whole ecosystem is a bit of mess at the moment and I would likely never have got to that particular combination of experimentation!

We have a lot of teams using this workflow and were going to need to resort to manual releases until it shook out - Really appreciate it! 🙏🏻

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 4.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

cycjimmy commented 1 year ago

The latest v4 version already uses the node20 container and supports the latest version of semantic-release.

MAN-Sendance commented 1 year ago

Indeed conventional-changelog-conventionalcommits@6.1.0 makes it work again.