File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 workflow_dispatch :
55 inputs :
66 version_type :
7- description : ' Version bump type'
7+ description : ' Version bump type, or current to publish the package.json version '
88 required : true
99 default : ' patch'
1010 type : choice
1111 options :
12+ - current
1213 - patch
1314 - minor
1415 - major
@@ -48,13 +49,19 @@ jobs:
4849 - name : Bump version
4950 id : version
5051 run : |
51- npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
52+ if [ "${{ github.event.inputs.version_type }}" != "current" ]; then
53+ npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
54+ fi
5255
53- NEW_VERSION=$(node -p "require('./package.json').version")
54- echo "new_version=v$NEW_VERSION" >> $GITHUB_OUTPUT
56+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
57+ NEW_VERSION="v$PACKAGE_VERSION"
58+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
59+ echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
5560
56- git add package.json package-lock.json
57- git commit -m "🔖 v$NEW_VERSION"
61+ if [ "${{ github.event.inputs.version_type }}" != "current" ]; then
62+ git add package.json package-lock.json
63+ git commit -m "🔖 v$PACKAGE_VERSION"
64+ fi
5865
5966 - name : Get previous published version
6067 id : prev_version
8895 echo 'RELEASE_EOF'
8996 } >> $GITHUB_OUTPUT
9097
98+ - name : Verify package version is unpublished
99+ run : |
100+ if npm view @vizzly-testing/cli@${{ steps.version.outputs.package_version }} version >/dev/null 2>&1; then
101+ echo "@vizzly-testing/cli@${{ steps.version.outputs.package_version }} is already published"
102+ exit 1
103+ fi
104+
91105 - name : Publish to NPM
92106 run : npm publish --provenance --access public
93107
You can’t perform that action at this time.
0 commit comments