@@ -3,7 +3,7 @@ name: Deploy library on NPM
33on :
44 release :
55 types : [created, edited, published]
6-
6+
77# Declare default permissions as read only.
88permissions : read-all
99
2424 uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
2525 with :
2626 files : " package.json, README.md"
27-
27+
2828 - name : File exists
2929 if : steps.check_files.outputs.files_exists != 'true'
3030 # Only runs if all of the files exists
5555 if : github.ref != steps.get_package_info.outputs.PACKAGE_VERSION
5656 # Fail if package version not properly setted
5757 run : exit 1
58-
58+
5959 - name : Check if package repository matches with repository
6060 if : github.repositoryUrl != steps.get_package_info.outputs.PACKAGE_REPOSITORY
6161 # Fail if package repository doesn't match with repository
@@ -80,12 +80,12 @@ jobs:
8080
8181 - name : Pre upload validation
8282 id : pack
83- run : |
83+ run : |
8484 rm -f *.tgz
8585 PRE_UPLOAD_HASH=$(npm pack --dry-run 2>&1 | grep 'shasum:' | awk '{print $NF}')
8686 echo "PRE_UPLOAD_HASH=$PRE_UPLOAD_HASH" >> $GITHUB_OUTPUT
8787 echo "PRE_UPLOAD_HASH: $PRE_UPLOAD_HASH"
88-
88+
8989 - name : Check if version is already published
9090 run : |
9191 PACKAGE_NAME=$(cat package.json | jq -r .name)
9999 echo "Version $PACKAGE_VERSION of $PACKAGE_NAME is not published. Proceeding with publishing..."
100100
101101 - name : Upload package
102- run : npm publish
103-
102+ run : |
103+ VERSION=${{ steps.get_package_info.outputs.PACKAGE_VERSION }}
104+ if [[ "$VERSION" == *"beta"* ]]; then
105+ echo "Publishing beta version ($VERSION)"
106+ npm publish --tag beta
107+ else
108+ echo "Publishing stable version ($VERSION)"
109+ npm publish
110+ fi
104111 - name : Post upload validation
105112 id : unpack
106113 run : |
0 commit comments