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