Skip to content

Commit 7b5f5de

Browse files
committed
publish workflow
1 parent 3ac9c6c commit 7b5f5de

4 files changed

Lines changed: 72 additions & 33 deletions

File tree

.github/workflows/publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish (leave empty to use package.json version)'
10+
required: false
11+
type: string
12+
13+
# Required for npm provenance and trusted publishing
14+
permissions:
15+
contents: read
16+
id-token: write
17+
18+
jobs:
19+
publish:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 10
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20'
34+
registry-url: 'https://registry.npmjs.org'
35+
36+
- name: Get pnpm store directory
37+
id: pnpm-cache
38+
shell: bash
39+
run: |
40+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
41+
42+
- name: Setup pnpm cache
43+
uses: actions/cache@v3
44+
with:
45+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Build
54+
run: pnpm run build
55+
56+
- name: Update version (if specified)
57+
if: ${{ github.event.inputs.version != '' }}
58+
run: |
59+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
60+
61+
- name: Publish to npm
62+
run: npm publish --provenance --access public
63+
env:
64+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
65+

.github/workflows/release.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Cloudsec CLI
22

3+
[![npm version](https://img.shields.io/npm/v/cloudsec)](https://www.npmjs.com/package/cloudsec)
4+
35
A command-line tool for managing Google Cloud Platform (GCP) secrets across multiple environments. Cloudsec simplifies secret management by providing a unified interface to create, read, update, and delete secrets stored in GCP Secret Manager.
46

57
## Features

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"link": "npm link",
1313
"start": "node dist/index.js",
1414
"clean": "rm -rf dist",
15-
"prepublishOnly": "npm run build"
15+
"prepublishOnly": "pnpm run build"
1616
},
1717
"files": [
1818
"dist",
@@ -41,5 +41,9 @@
4141
},
4242
"engines": {
4343
"node": ">=18.0.0"
44+
},
45+
"publishConfig": {
46+
"access": "public",
47+
"registry": "https://registry.npmjs.org"
4448
}
4549
}

0 commit comments

Comments
 (0)