Skip to content

Commit c982af1

Browse files
committed
chore(experimental): allow for publishing via ci
1 parent d091d77 commit c982af1

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: experimental-inventory-cli - Publish to NPM
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'release version without v prefix'
7+
required: true
8+
type: string
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Harden Runner
17+
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
18+
with:
19+
egress-policy: audit
20+
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22+
23+
# Setup .npmrc file to publish to npm
24+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
25+
with:
26+
node-version: '18.x'
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: check version matches input
30+
run: |
31+
grep "\"version\": \"${{ github.event.inputs.version }}\"," package.json
32+
working-directory: ./experimental/li-cli
33+
34+
- run: npm ci
35+
working-directory: ./experimental/li-cli
36+
37+
- run: npm run build
38+
working-directory: ./experimental/li-cli
39+
40+
- run: npm publish --access=public
41+
working-directory: ./experimental/li-cli
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/experimental-inventory-publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: experimental-inventory - Publish to NPM
22
on:
3-
push:
4-
tags:
5-
- 'license-inventory-*'
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'release version without v prefix'
7+
required: true
8+
type: string
69
permissions:
710
contents: read
811

@@ -23,6 +26,11 @@ jobs:
2326
node-version: '18.x'
2427
registry-url: 'https://registry.npmjs.org'
2528

29+
- name: check version matches input
30+
run: |
31+
grep "\"version\": \"${{ github.event.inputs.version }}\"," package.json
32+
working-directory: ./experimental/license-inventory
33+
2634
- run: npm ci
2735
working-directory: ./experimental/license-inventory
2836

0 commit comments

Comments
 (0)