lsd-rs / lsd

The next gen ls command
Apache License 2.0
13.05k stars 425 forks source link

CI/CD: PowerShell completion script is built but not released #952

Closed YDX-2147483647 closed 9 months ago

YDX-2147483647 commented 9 months ago

In autocomplete/ of lsd-v1.0.0-x86_64-pc-windows-*.zip from https://github.com/lsd-rs/lsd/releases/tag/v1.0.0, there are only lsd.bash-completion, lsd.fish, and _lsd, but not _lsd.ps1.

We are building _lsd.ps1, but the workflow never releases it!

https://github.com/lsd-rs/lsd/blob/6f8e09524835cf15f5d5a9a7a1701e71dbe78f01/build.rs#L32-L36

https://github.com/lsd-rs/lsd/blob/6f8e09524835cf15f5d5a9a7a1701e71dbe78f01/.github/workflows/CICD.yml#L228-L231

I notice that _lsd.ps1 is built but not released from the beginning (commit 98bc907: Add a complete CD)… Is it on purpose? If not, I can make a PR. I've submitted #953. If that's intentional, please close it.

Possible fix

Add the following line to CICD.yml.

         cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}-'*/'out/_${{ env.PROJECT_NAME }}.ps1' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete/' 

The filename _lsd.ps1 is hard coded in clap, and I've verified it locally.

impl Generator for PowerShell {
    fn file_name(&self, name: &str) -> String {
        format!("_{name}.ps1")
    }
}
$ lsd ./target/debug/build/lsd-4e8da84150b024f4/out
_lsd  _lsd.ps1  lsd.bash  lsd.fish

(Besides, ripgrep releases _lsd.ps1 in a similar way)

https://github.com/BurntSushi/ripgrep/blob/7099e174acbcbd940f57e4ab4913fee4040c826e/.github/workflows/release.yml#L150-L151

        cp "$outdir"/{rg.bash,rg.fish,_rg.ps1} "$staging/complete/"
        cp complete/_rg "$staging/complete/"