github actions windows tar错误

0

最近使用github进行自动打包,但是发现tar在windows系统里面总是提示错误:

tar.exe: ./build/snail: Couldn't find file: Invalid argument
tar.exe: Error exit delayed from previous errors.

Error: Process completed with exit code 1.

后来发现需要在参数后面添加星号:

# 错误命令
tar -zcvf snail-${{ matrix.runs-on }}.tar.gz ./build/snail/
# 正确命令
tar -zcvf snail-${{ matrix.runs-on }}.tar.gz ./build/snail/*

另外一个错误:

tar: Exiting with failure status due to previous errors
Error: Process completed with exit code 2.

这个是因为命令错误:

# 错误命令
tar -cvf snail-${{ matrix.runs-on }}.tar -C ./build/ snail/*
# 正确命令
tar -cvf snail-${{ matrix.runs-on }}.tar -C ./build/ snail