-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash -xv | ||
|
||
# Removes "v" prefix | ||
version=${GITHUB_REF_NAME:1} | ||
|
||
# Major of the version being handled by the current workflow | ||
workflow_major=$(echo $version | cut -d. -f1) | ||
|
||
workflow_track="latest-v${workflow_major}.x" | ||
|
||
# Major of the version published under the current "latest" npm tag | ||
latest_major=$(npm view cross-fetch@latest version | cut -d. -f1) | ||
|
||
|
||
# If it's test prerelease, we just want to test the release workflow (dry run it!) | ||
if [[ "$version" == *"-test."* ]]; then | ||
npm publish --tag $workflow_track --dry-run && \ | ||
exit 0 | ||
fi | ||
|
||
npm publish --tag $workflow_track | ||
|
||
if [[ "$workflow_major" == "$latest_major" ]]; then | ||
npm dist-tag add cross-fetch@$version latest | ||
fi | ||
|
||
if [[ "$workflow_major" == "$(($latest_major + 1))" ]]; then | ||
npm dist-tag add cross-fetch@$version next | ||
fi |