Skip to content

Commit ff14bdd

Browse files
committed
chore: improved release script
1 parent d625e0d commit ff14bdd

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

release

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
#!/bin/bash -xv
22

3-
# Removes "v" prefix
4-
version=${GITHUB_REF_NAME:1}
5-
6-
# Major of the version being handled by the current workflow
3+
# Get the git tag that triggered the workflow build
4+
workflow_version=${GITHUB_REF_NAME:1} # Removed the "v" prefix
5+
# Get version major being handled by the current workflow
76
workflow_major=$(echo $version | cut -d. -f1)
8-
97
workflow_track="latest-v${workflow_major}.x"
108

11-
# Major of the version published under the current "latest" npm tag
12-
latest_major=$(npm view cross-fetch@latest version | cut -d. -f1)
9+
# Get latest version on npm registry
10+
latest_version=$(npm view cross-fetch@latest version)
11+
# Get version major published under the current "latest" npm tag
12+
latest_major=$(echo $latest_version | cut -d. -f1)
1313

1414

15-
# If it's test prerelease, we just want to test the release workflow (dry run it!)
16-
if [[ "$version" == *"-test."* ]]; then
15+
# If it's a test prerelease, we just want to test the release workflow (dry run it!)
16+
if [[ "$workflow_version" == *"-test."* ]]; then
1717
npm publish --tag $workflow_track --dry-run && \
1818
exit 0
1919
fi
2020

2121
npm publish --tag $workflow_track
2222

2323
if [[ "$workflow_major" == "$latest_major" ]]; then
24-
npm dist-tag add cross-fetch@$version latest
24+
npm dist-tag add cross-fetch@$workflow_version latest
2525
fi
2626

2727
if [[ "$workflow_major" == "$(($latest_major + 1))" ]]; then
28-
npm dist-tag add cross-fetch@$version next
28+
npm dist-tag add cross-fetch@$workflow_version next
2929
fi

0 commit comments

Comments
 (0)