Skip to content

Commit 1b5fa38

Browse files
Merge #1414
1414: Improve the check-release tag parser to be more robust r=bidoubiwa a=bidoubiwa `check-release.yml` used to parse the `GITHUB_REF` with `tr -d 'refs/tags/v'`. But, `tr` deletes characters and not a specific string. Which results in a wrong parsing of tags containings the characters present in `refs/tags/v`. Example: `refs/tags/v0.1.0-strapi-v3.1` becomes `0.1.0-pi-v3.1` To avoid this issue, the command is changed to a more robust parsing method: `cut -d '/' -f 3 | sed -r 's/^v//'` - `cut -d '/' -f 3` splits our string based on the `/` and takes the 3th element. `refs/tags/v0.1.0-strapi-v3.1` => `["refs", "tags", "v0.1.0-strapi-v3.1"]` - `sed -r 's/^v//'` removes the prepending `v`. `v0.1.0-strapi-v3.1` => `0.1.0-strapi-v3.1` Co-authored-by: cvermand <[email protected]>
2 parents 82ecc7c + d2ff49d commit 1b5fa38

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/scripts/check-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# Checking if current tag matches the package version
4-
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
4+
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')
55

66
package_json_version=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
77
if [ "$current_tag" != "$package_json_version" ]; then

0 commit comments

Comments
 (0)