@@ -42,14 +42,22 @@ runs:
4242 - name : Update npm Packages
4343 if : ${{ steps.env.outputs.ENV == 'npm' }}
4444 run : |
45- sed -i 's/"version": ".*"/"version": "${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
46- # TODO: Following should only happen in dependencies and not devDependencies
47- # sed -i 's/"\*"/"${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
45+ jq --arg version "${{ steps.version.outputs.VERSION }}" '
46+ .version = $version
47+ ' ${{ inputs.manifest-file }} > tmp.json && mv tmp.json ${{ inputs.manifest-file }}
48+ jq --arg version "${{ steps.version.outputs.VERSION }}" '
49+ .dependencies |= with_entries(if .value == "*" then .value = $version else . end)
50+ ' ${{ inputs.manifest-file }} > tmp.json && mv tmp.json ${{ inputs.manifest-file }}
4851 shell : bash
4952 - name : Update Cargo Packages
5053 if : ${{ steps.env.outputs.ENV == 'cargo' }}
5154 run : |
52- sed -i 's/^version = ".*"$/version = "${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
53- # TODO: Following should only happen in dependencies and not dev-dependencies
54- # sed -i 's/path = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' ${{ inputs.manifest-file }}
55+ awk -v version="${{ steps.version.outputs.VERSION }}" '
56+ /^version = / { sub(/".*"/, "\"" version "\"") } { print }
57+ ' ${{ inputs.manifest-file }} > tmp.toml && mv tmp.toml ${{ inputs.manifest-file }}
58+ awk -v version="${{ steps.version.outputs.VERSION }}" '
59+ /^\[dependencies\]/ { in_dependencies=1 }
60+ /^\[/ && !/^\[dependencies\]/ { in_dependencies=0 }
61+ in_dependencies && /path = ".*"/ { sub(/path = ".*"/, "version = \"" version "\"") } { print }
62+ ' ${{ inputs.manifest-file }} > tmp.toml && mv tmp.toml ${{ inputs.manifest-file }}
5563 shell : bash
0 commit comments