7171 LATEST_VERSION=$(npm view enum-plus version)
7272 echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_OUTPUT
7373
74+ - name : Request the next version of enum-plus
75+ id : get_next_version_before_publish
76+ run : |
77+ NEXT_VERSION=$(npm view enum-plus@next version || npm view enum-plus version)
78+ echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
79+
7480 - name : Publish a prerelease version to npm
7581 run : npm publish --tag beta --ignore-scripts --access=public
7682 if : github.event.release.prerelease
@@ -84,15 +90,21 @@ jobs:
8490 NODE_AUTH_TOKEN : ${{ secrets.npm_token }}
8591
8692 - uses : madhead/semver-utils@latest
87- id : compare_versions
93+ id : new_vs_latest
8894 with :
8995 version : ${{ github.event.release.tag_name }}
9096 compare-to : ${{ steps.get_latest_version_before_publish.outputs.LATEST_VERSION }}
9197
98+ - uses : madhead/semver-utils@latest
99+ id : new_vs_next
100+ with :
101+ version : ${{ github.event.release.tag_name }}
102+ compare-to : ${{ steps.get_next_version_before_publish.outputs.NEXT_VERSION }}
103+
92104 - name : Add npm dist-tag for "next"
93105 if : github.event.release.prerelease
94106 run : |
95- if [ "${{ steps.compare_versions .outputs.comparison-result }}" = ">" ]; then
107+ if [ "${{ steps.new_vs_latest .outputs.comparison-result }}" = ">" ]; then
96108 npm dist-tag add enum-plus@${{ github.event.release.tag_name }} next --access=public
97109 fi
98110 env :
@@ -101,13 +113,13 @@ jobs:
101113 - name : Remove npm dist-tag for "next"
102114 if : github.event.release.prerelease == false
103115 run : |
104- if [ "${{ steps.compare_versions .outputs.comparison-result }}" = ">" ]; then
116+ if [ "${{ steps.new_vs_next .outputs.comparison-result }}" = ">" ]; then
105117 npm dist-tag rm enum-plus next --access=public
106118 fi
107119 env :
108120 NODE_AUTH_TOKEN : ${{ secrets.npm_token }}
109121
110- - name : Request the latest version of enum-plus
122+ - name : Request the latest stable version of enum-plus
111123 id : get_latest_version_after_publish
112124 run : |
113125 LATEST_VERSION=$(npm view enum-plus version)
0 commit comments