semantic-release / github

:octocat: semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues
https://www.npmjs.com/package/@semantic-release/github
MIT License
419 stars 129 forks source link

Publish step hanging with partial success - possible globbing issue #375

Open mikebrant-xdelivery opened 3 years ago

mikebrant-xdelivery commented 3 years ago

My issue seems very similar to this closed issue - https://github.com/semantic-release/github/issues/193 - but since that is closed and a couple of years old I figured it might not be relevant.

Even with debug logging turned on, the logs go silent after this log message - https://github.com/semantic-release/github/blob/master/lib/publish.js#L34 . The draft release is created correctly, we just never seem to make it as far as https://github.com/semantic-release/github/blob/master/lib/publish.js#L56 as we never get any additional debug logging. So it seems perhaps there is an issue with the glob step.

The complete log entries from release that are relevant to github plugin are shown below.

[3:29:08 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
    '  export RELEASE_VERSION="$RELEASE_VERSION"\n' +
...
2021-05-26T15:29:08.805Z semantic-release:plugins options for @semantic-release/github/verifyConditions: {
  assets: [ { path: '**', label: 'distribution files' } ],
  failComment: false,
  successComment: false
}
...
2021-05-26T15:29:08.805Z semantic-release:plugins options for @semantic-release/github/verifyConditions: {
  assets: [ { path: '**', label: 'distribution files' } ],
  failComment: false,
  successComment: false
}
...
[3:29:08 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
...
[3:29:08 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
2021-05-26T15:29:08.811Z semantic-release:plugins options for @semantic-release/github/success: {
  assets: [ { path: '**', label: 'distribution files' } ],
  failComment: false,
  successComment: false
}
...
2021-05-26T15:29:08.812Z semantic-release:plugins options for @semantic-release/github/fail: {
  assets: [ { path: '**', label: 'distribution files' } ],
  failComment: false,
  successComment: false
}
...
[3:29:08 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
...
[3:29:08 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
...
[3:29:13 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[3:29:13 PM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication (https://api.github.com)
[3:29:13 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
...
[3:29:20 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/github"
2021-05-26T15:29:20.072Z semantic-release:github release object: {
  owner: 'onelive-dev',
  repo: 'OLX',
  tag_name: 'v1.5.0-cicd.3',
  target_commitish: 'cicd',
  name: 'v1.5.0-cicd.3',
  body: '# [1.5.0-cicd.3](https://github.com/onelive-dev/OLX/compare/v1.5.0-cicd.2...v1.5.0-cicd.3) (2021-05-26)\n' +
    '\n' +
    '\n' +
    '### Bug Fixes\n' +
    '\n' +
    '* **cicd:** enable semantic-release debug + force release ([d262911](https://github.com/onelive-dev/OLX/commit/d26291168b6b82d16d56eed242c12ef60871e8ce))\n' +
    '\n' +
    '\n' +
    '\n',
  prerelease: true
}

Our .releaserc.yml file is as follows

branches:
  - master
# @todo enable automated release for all branches once some outstanding branches with non-compliant names are closed
#  - name: '**'
#    prerelease: true
  - name: cicd
    prerelease: true
plugins:
  - '@semantic-release/commit-analyzer'
  - '@semantic-release/release-notes-generator'
  - '@semantic-release/changelog'
  - - '@semantic-release/exec'
    # This hook is run only if a release is to be made
    # We create source-able file so future workflow steps can easily get to release metadata
    - prepareCmd: |
        RELEASE_VERSION="${nextRelease.version}"
        echo "Version to be released: $RELEASE_VERSION"
        cat > version.sh <<-EOF
          #!/bin/bash
          export RELEASE_VERSION="$RELEASE_VERSION"
          export RELEASE_CHANNEL="${nextRelease.channel}"
          export RELEASE_HEAD="${nextRelease.gitHead}"
          export RELEASE_NOTES="${nextRelease.notes}"
          export RELEASE_TAG="${nextRelease.gitTag}"
          export RELEASE_TYPE="${nextRelease.type}"
        EOF
  - - '@semantic-release/npm'
    - npmPublish: false
  - - '@semantic-release/git'
    - assets:
        - CHANGELOG.md
        - package.json
        - package-lock.json
  - - '@semantic-release/github'
    - assets:
        - path: '**'
          label: distribution files
      failComment: false
      successComment: false

Note I am able to make releases by making npm plugin generate a tarball and explicitly using that tarball in assets config. So a config like this works.

branches:
  - master
# @todo enable automated release for all branches once some outstanding branches with non-compliant names are closed
#  - name: '**'
#    prerelease: true
  - name: cicd
    prerelease: true
plugins:
  - '@semantic-release/commit-analyzer'
  - '@semantic-release/release-notes-generator'
  - '@semantic-release/changelog'
  - - '@semantic-release/exec'
    # This hook is run only if a release is to be made
    # We create source-able file so future workflow steps can easily get to release metadata
    - prepareCmd: |
        RELEASE_VERSION="${nextRelease.version}"
        echo "Version to be released: $RELEASE_VERSION"
        cat > version.sh <<-EOF
          #!/bin/bash
          export RELEASE_VERSION="$RELEASE_VERSION"
          export RELEASE_CHANNEL="${nextRelease.channel}"
          export RELEASE_HEAD="${nextRelease.gitHead}"
          export RELEASE_NOTES="${nextRelease.notes}"
          export RELEASE_TAG="${nextRelease.gitTag}"
          export RELEASE_TYPE="${nextRelease.type}"
        EOF
  - - '@semantic-release/npm'
    - npmPublish: false
      tarballDir: dist
  - - '@semantic-release/git'
    - assets:
        - CHANGELOG.md
        - package.json
        - package-lock.json
  - - '@semantic-release/github'
    - assets:
        - path: dist/*.tgz
          label: distribution files
guruantree commented 3 years ago

375

BinToss commented 3 years ago

So the issue seems to be that items in the "current directory" can't be globbed with a pattern of **. Going the NOT pattern in this example... Have you tried adding a path separator at the end? e.g. **/ If that doesn't work, then maybe try **/*. This one works as expected in Powershell, though Node Glob might work differently.