File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish to npm
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+
8+ permissions :
9+ contents : read
10+ id-token : write # Required for OIDC
11+
12+ jobs :
13+ publish :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v4
18+
19+ - name : Setup Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : ' 24'
23+ registry-url : ' https://registry.npmjs.org'
24+
25+ - name : Install dependencies
26+ run : npm ci
27+
28+ - name : Build library
29+ run : npm run pack-lib
30+
31+ - name : Check if version exists
32+ id : check_version
33+ run : |
34+ PACKAGE_NAME=$(node -p "require('./package.json').name")
35+ VERSION=$(node -p "require('./package.json').version")
36+ echo "Checking if $PACKAGE_NAME@$VERSION exists..."
37+
38+ if npm view "$PACKAGE_NAME@$VERSION" version &>/dev/null; then
39+ echo "Version $VERSION already exists in registry"
40+ echo "should_publish=false" >> $GITHUB_OUTPUT
41+ else
42+ echo "Version $VERSION does not exist, will publish"
43+ echo "should_publish=true" >> $GITHUB_OUTPUT
44+ fi
45+ working-directory : ./dist/ngx-appshell
46+
47+ - name : Publish to npm
48+ if : steps.check_version.outputs.should_publish == 'true'
49+ run : npm publish --access public
50+ working-directory : ./dist/ngx-appshell
You can’t perform that action at this time.
0 commit comments