Use realpath.
This commit is contained in:
@@ -32,15 +32,12 @@ runs:
|
|||||||
node-version: ${{ inputs.nodeVersion }}
|
node-version: ${{ inputs.nodeVersion }}
|
||||||
- name: "Publish package"
|
- name: "Publish package"
|
||||||
run: |
|
run: |
|
||||||
# Ensure path starts with ./ so npm recognizes it as a file path
|
|
||||||
TGZ_PATH="${{ inputs.tgz }}"
|
TGZ_PATH="${{ inputs.tgz }}"
|
||||||
# Trim whitespace
|
# Trim whitespace
|
||||||
TGZ_PATH=$(echo "$TGZ_PATH" | xargs)
|
TGZ_PATH=$(echo "$TGZ_PATH" | xargs)
|
||||||
|
|
||||||
if [[ ! "$TGZ_PATH" =~ ^(\./|/|~) ]]; then
|
# Resolve to absolute path so npm never misinterprets it as a git shorthand
|
||||||
echo "Path does not start with ./ / or ~, adding ./ prefix"
|
TGZ_PATH="$(realpath "$TGZ_PATH")"
|
||||||
TGZ_PATH="./$TGZ_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify the tarball exists
|
# Verify the tarball exists
|
||||||
if [ ! -f "$TGZ_PATH" ]; then
|
if [ ! -f "$TGZ_PATH" ]; then
|
||||||
@@ -55,8 +52,6 @@ runs:
|
|||||||
|
|
||||||
echo "Publishing $TGZ_PATH to ${{ inputs.registry }}"
|
echo "Publishing $TGZ_PATH to ${{ inputs.registry }}"
|
||||||
npm publish "$TGZ_PATH" --access ${{ inputs.access }}
|
npm publish "$TGZ_PATH" --access ${{ inputs.access }}
|
||||||
|
|
||||||
echo "Package published successfully"
|
|
||||||
working-directory: ${{ inputs.workingDirectory }}
|
working-directory: ${{ inputs.workingDirectory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: "Clean up npm authentication"
|
- name: "Clean up npm authentication"
|
||||||
|
|||||||
Reference in New Issue
Block a user