File tree Expand file tree Collapse file tree 4 files changed +84
-4
lines changed
deep-review/.github/workflows
pi-notify/.github/workflows
pi-system-theme/.github/workflows Expand file tree Collapse file tree 4 files changed +84
-4
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,34 @@ jobs:
2323 node-version : " 22"
2424 registry-url : " https://registry.npmjs.org"
2525
26+ - name : Read package metadata
27+ id : pkg
28+ run : |
29+ echo "name=$(node -p \"require('./package.json').name\")" >> "$GITHUB_OUTPUT"
30+ echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
31+
2632 - name : Verify tag matches package version
2733 run : |
2834 TAG="${{ github.event.release.tag_name }}"
29- VERSION="$(node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); process.stdout.write( pkg.version)") "
35+ VERSION="${{ steps. pkg.outputs. version }} "
3036 if [ "v$VERSION" != "$TAG" ]; then
3137 echo "Tag $TAG does not match package.json version $VERSION"
3238 exit 1
3339 fi
3440
41+ - name : Check whether version already exists on npm
42+ id : npm_exists
43+ run : |
44+ if npm view "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }}" version >/dev/null 2>&1; then
45+ echo "exists=true" >> "$GITHUB_OUTPUT"
46+ else
47+ echo "exists=false" >> "$GITHUB_OUTPUT"
48+ fi
49+
3550 - name : Publish to npm (trusted publisher / OIDC)
51+ if : steps.npm_exists.outputs.exists != 'true'
3652 run : npm publish --provenance
53+
54+ - name : Skip message (already published)
55+ if : steps.npm_exists.outputs.exists == 'true'
56+ run : echo "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }} already exists on npm; skipping publish."
Original file line number Diff line number Diff line change @@ -23,14 +23,34 @@ jobs:
2323 node-version : " 22"
2424 registry-url : " https://registry.npmjs.org"
2525
26+ - name : Read package metadata
27+ id : pkg
28+ run : |
29+ echo "name=$(node -p \"require('./package.json').name\")" >> "$GITHUB_OUTPUT"
30+ echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
31+
2632 - name : Verify tag matches package version
2733 run : |
2834 TAG="${{ github.event.release.tag_name }}"
29- VERSION="$(node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); process.stdout.write( pkg.version)") "
35+ VERSION="${{ steps. pkg.outputs. version }} "
3036 if [ "v$VERSION" != "$TAG" ]; then
3137 echo "Tag $TAG does not match package.json version $VERSION"
3238 exit 1
3339 fi
3440
41+ - name : Check whether version already exists on npm
42+ id : npm_exists
43+ run : |
44+ if npm view "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }}" version >/dev/null 2>&1; then
45+ echo "exists=true" >> "$GITHUB_OUTPUT"
46+ else
47+ echo "exists=false" >> "$GITHUB_OUTPUT"
48+ fi
49+
3550 - name : Publish to npm (trusted publisher / OIDC)
51+ if : steps.npm_exists.outputs.exists != 'true'
3652 run : npm publish --provenance
53+
54+ - name : Skip message (already published)
55+ if : steps.npm_exists.outputs.exists == 'true'
56+ run : echo "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }} already exists on npm; skipping publish."
Original file line number Diff line number Diff line change @@ -23,14 +23,34 @@ jobs:
2323 node-version : " 22"
2424 registry-url : " https://registry.npmjs.org"
2525
26+ - name : Read package metadata
27+ id : pkg
28+ run : |
29+ echo "name=$(node -p \"require('./package.json').name\")" >> "$GITHUB_OUTPUT"
30+ echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
31+
2632 - name : Verify tag matches package version
2733 run : |
2834 TAG="${{ github.event.release.tag_name }}"
29- VERSION="$(node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); process.stdout.write( pkg.version)") "
35+ VERSION="${{ steps. pkg.outputs. version }} "
3036 if [ "v$VERSION" != "$TAG" ]; then
3137 echo "Tag $TAG does not match package.json version $VERSION"
3238 exit 1
3339 fi
3440
41+ - name : Check whether version already exists on npm
42+ id : npm_exists
43+ run : |
44+ if npm view "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }}" version >/dev/null 2>&1; then
45+ echo "exists=true" >> "$GITHUB_OUTPUT"
46+ else
47+ echo "exists=false" >> "$GITHUB_OUTPUT"
48+ fi
49+
3550 - name : Publish to npm (trusted publisher / OIDC)
51+ if : steps.npm_exists.outputs.exists != 'true'
3652 run : npm publish --provenance
53+
54+ - name : Skip message (already published)
55+ if : steps.npm_exists.outputs.exists == 'true'
56+ run : echo "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }} already exists on npm; skipping publish."
Original file line number Diff line number Diff line change @@ -23,14 +23,34 @@ jobs:
2323 node-version : " 22"
2424 registry-url : " https://registry.npmjs.org"
2525
26+ - name : Read package metadata
27+ id : pkg
28+ run : |
29+ echo "name=$(node -p \"require('./package.json').name\")" >> "$GITHUB_OUTPUT"
30+ echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
31+
2632 - name : Verify tag matches package version
2733 run : |
2834 TAG="${{ github.event.release.tag_name }}"
29- VERSION="$(node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); process.stdout.write( pkg.version)") "
35+ VERSION="${{ steps. pkg.outputs. version }} "
3036 if [ "v$VERSION" != "$TAG" ]; then
3137 echo "Tag $TAG does not match package.json version $VERSION"
3238 exit 1
3339 fi
3440
41+ - name : Check whether version already exists on npm
42+ id : npm_exists
43+ run : |
44+ if npm view "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }}" version >/dev/null 2>&1; then
45+ echo "exists=true" >> "$GITHUB_OUTPUT"
46+ else
47+ echo "exists=false" >> "$GITHUB_OUTPUT"
48+ fi
49+
3550 - name : Publish to npm (trusted publisher / OIDC)
51+ if : steps.npm_exists.outputs.exists != 'true'
3652 run : npm publish --provenance
53+
54+ - name : Skip message (already published)
55+ if : steps.npm_exists.outputs.exists == 'true'
56+ run : echo "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }} already exists on npm; skipping publish."
You can’t perform that action at this time.
0 commit comments