Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publishing from Windows breaks with default arguments #391

Closed
FirefoxMetzger opened this issue Oct 20, 2021 · 4 comments · Fixed by #393
Closed

publishing from Windows breaks with default arguments #391

FirefoxMetzger opened this issue Oct 20, 2021 · 4 comments · Fixed by #393
Labels
bug Something isn't working properly

Comments

@FirefoxMetzger
Copy link
Contributor

FirefoxMetzger commented Oct 20, 2021

The problem

https://github.com/relekang/python-semantic-release/blob/f010a15dd03f4ef34e4093cc1a7ee357c6db12eb/semantic_release/dist.py#L31-L34

The above line works fine on Linux-based systems but breaks on Windows when using the default shell (PowerShell), because -rf is incorrect syntax. The default setting is to remove the dist folder after building, which currently breaks semantic-release publish unless deleting is explicitly disabled.

Expected behavior

Deletion of the folder works as expected regardless of operating system.

A fix that should work on any OS could look something like this

import shutil

def remove_dists(path: str):
    logger.debug(f"Removing build folder: `{path}`")
    shutil.rmtree(path)
@FirefoxMetzger FirefoxMetzger added the bug Something isn't working properly label Oct 20, 2021
@FirefoxMetzger
Copy link
Contributor Author

PS: If a maintainer is happy to review, I can make a PR with the suggested fix :)

@danth
Copy link
Member

danth commented Oct 21, 2021

I would be happy to merge a PR for this.

@lalish99
Copy link

Hi, just to note, that this broke my action.

I had the following implementation:

name: Deploy Main
on:
  push:
    branches:
      - main

jobs:

  release:
    runs-on: ubuntu-latest
    concurrency: release
    outputs:
      tag: ${{ steps.release.outputs.tag }}

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Python Semantic Release
      uses: relekang/python-semantic-release@master
      with:
        github_token: ${{ secrets.GH_TOKEN }}

    - name: Expose Release
      id: expose-release
      run: echo "::set-output name=tag::$RELEASE_VERSION"

And it stopped working with the following output on the action:

Building distributions
debug: Removing build folder: `dist`
error: [Errno 2] No such file or directory: 'dist'

After changing the version I use from @masterto @v7.19.2it started working properly again.

I beilive this issue, and #393 caused the error. Given that the release v7.19.2 does not include the solution mentioned here (#393).

@danth
Copy link
Member

danth commented Oct 25, 2021

I think adding ignore_errors=True in the arguments to shutil.rmtree will fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants