File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,30 @@ jobs:
2121 run : yarn build
2222 - name : Get the release tag version
2323 id : get_version
24- run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
24+ run : echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
25+ - name : Extract pre-release tag if any
26+ id : extract_tag
27+ run : |
28+ VERSION="${{ steps.get_version.outputs.VERSION }}"
29+ if [[ $VERSION == *-* ]]; then
30+ # Extract everything between hyphen and last period (or end of string)
31+ PRETAG=$(echo $VERSION | sed -E 's/.*-([^.]+).*/\1/')
32+ echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
33+ echo "NPM_TAG=$PRETAG" >> $GITHUB_OUTPUT
34+ else
35+ echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
36+ echo "NPM_TAG=latest" >> $GITHUB_OUTPUT
37+ fi
38+ - name : Get source branch
39+ id : get_branch
40+ run : |
41+ RELEASE_COMMIT=$(git rev-list -n 1 ${{ steps.get_version.outputs.VERSION }})
42+ SOURCE_BRANCH=$(git branch -r --contains $RELEASE_COMMIT | grep -v HEAD | head -n 1 | sed 's/.*origin\///')
43+ echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_OUTPUT
2544 - name : Set package version
2645 run : yarn version --new-version "${{ steps.get_version.outputs.VERSION }}" --no-git-tag-version
2746 - name : Publish package
28- run : yarn publish --access public
47+ run : yarn publish --access public --tag ${{ steps.extract_tag.outputs.NPM_TAG }}
2948 env :
3049 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
3150 - name : Push version bump
You can’t perform that action at this time.
0 commit comments