Skip to content

Commit

Permalink
chore: improved release script
Browse files Browse the repository at this point in the history
  • Loading branch information
lquixada committed Jul 2, 2023
1 parent db4761d commit f28d880
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions release
@@ -1,29 +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)

# Get the git tag that triggered the workflow build
workflow_version=${GITHUB_REF_NAME:1} # Removed the "v" prefix
# Get version major being handled by the current workflow
workflow_major=$(echo $workflow_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)
# Get latest version on npm registry
latest_version=$(npm view cross-fetch@latest version)
# Get version major published under the current "latest" npm tag
latest_major=$(echo $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
# If it's a test prerelease, we just want to test the release workflow (dry run it!)
if [[ "$workflow_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
npm dist-tag add cross-fetch@$workflow_version latest
fi

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

0 comments on commit f28d880

Please sign in to comment.