Skip to content

Commit b4f6afb

Browse files
feat(api): manual updates
1 parent a29f450 commit b4f6afb

5 files changed

Lines changed: 62 additions & 7 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to NPM in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/stainless-commons/spotify-typescript/actions/workflows/publish-npm.yml
4+
name: Publish NPM
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
id-token: write
18+
19+
steps:
20+
- uses: actions/checkout@v6
21+
22+
- name: Set up Node
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '20'
26+
27+
- name: Set up pnpm
28+
uses: pnpm/action-setup@v4
29+
30+
- name: Install dependencies
31+
run: |
32+
pnpm install
33+
34+
- name: Publish to NPM
35+
run: |
36+
bash ./bin/publish-npm

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless-commons%2Fspotify-7ac9fe2ee73e38b2892f0393435f2d3a275d04b1d0728708382dd752da1d44de.yml
33
openapi_spec_hash: 6be3d4faa079ee82335208bec39c917a
4-
config_hash: e9eed48b634d363c8fb0052e81544e1e
4+
config_hash: 130d32e101fcd29858ba4453473724d6

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,17 @@ To format and fix all lint issues automatically:
8585
```sh
8686
$ pnpm fix
8787
```
88+
89+
## Publishing and releases
90+
91+
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
92+
the changes aren't made through the automated pipeline, you may want to make releases manually.
93+
94+
### Publish with a GitHub workflow
95+
96+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/stainless-commons/spotify-typescript/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
97+
98+
### Publish manually
99+
100+
If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
101+
the environment.

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ It is generated with [Stainless](https://www.stainless.com/).
1111
## Installation
1212

1313
```sh
14-
npm install git+ssh://git@github.com:stainless-commons/spotify-typescript.git
14+
npm install @stainless-commons/spotify
1515
```
1616

17-
> [!NOTE]
18-
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install @stainless-commons/spotify`
19-
2017
## Usage
2118

2219
The full API of this library can be found in [api.md](api.md).

bin/publish-npm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
set -eux
44

5-
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
5+
if [[ ${NPM_TOKEN:-} ]]; then
6+
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
7+
elif [[ ! ${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-} ]]; then
8+
echo "ERROR: NPM_TOKEN must be set if not running in a Github Action with id-token permission"
9+
exit 1
10+
fi
611

712
pnpm build
813
cd dist
@@ -57,5 +62,8 @@ else
5762
TAG="latest"
5863
fi
5964

65+
# Install OIDC compatible npm version
66+
npm install --prefix ../oidc/ npm@11.6.2
67+
6068
# Publish with the appropriate tag
61-
pnpm publish --no-git-checks --tag "$TAG"
69+
pnpm publish --npm-path "$(cd ../ && pwd)/oidc/node_modules/.bin/npm" --no-git-checks --tag "$TAG"

0 commit comments

Comments
 (0)