Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix latest npm dist tag when patching versions #45

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:

echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > ~/.npmrc


DIST_TAG=patched
if [ "$RELEASE_CANDIDATE" == "true" ]
then
Expand All @@ -98,6 +99,20 @@ jobs:
then
# This is the main branch and it's not a prerelease, so the dist-tag should be `latest`.
DIST_TAG=latest
elif [[ "$GITHUB_REF" == "refs/heads/release/"* ]]
then
# This is a release branch. We need to determine if this release
# branch is the _latest_ release branch. If yes, use
# DIST_TAG=latest. Make sure checkout action runs with
# fetch-depth: 0!

LATEST_BRANCH=$(git branch -al origin/release/* --sort=-v:refname | head -n 1 | tr -d "* \t")
REF_AS_REMOTE_BRANCH=$(echo "$GITHUB_REF" | sed "s|refs/heads/|remotes/origin/|g")

if [ "$LATEST_BRANCH" == "$REF_AS_REMOTE_BRANCH" ]
then
DIST_TAG=latest
fi
fi

echo "Publishing @supabase/ssr now..."
Expand Down