Skip to content

Commit 5bdc82d

Browse files
Onboard to NPM trusted publisher workflow (opensearch-js) (#1085)
* Onboard to NPM trusted publisher workflow (opensearch-js) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> * Update release details Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> --------- Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 4ba0e28 commit 5bdc82d

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

.github/workflows/release-drafter.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # Required for OIDC
13+
contents: write
14+
issues: write
1115
steps:
1216
- name: Checkout
1317
uses: actions/checkout@v4
@@ -23,8 +27,16 @@ jobs:
2327
issue-title: 'Release opensearch-js : ${{ steps.get_data.outputs.version }}'
2428
issue-body: "Please approve or deny the release of opensearch-js. **VERSION**: ${{ steps.get_data.outputs.version }} **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }}"
2529
exclude-workflow-initiator-as-approver: true
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: '24'
33+
registry-url: 'https://registry.npmjs.org'
34+
- run: npm ci
35+
# - run: npm run build --if-present
36+
# - run: npm test
37+
- run: npm publish
2638
- name: Release
2739
uses: softprops/action-gh-release@v2
2840
with:
29-
draft: true
30-
generate_release_notes: true
41+
draft: false
42+
generate_release_notes: true

RELEASING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The release process is standard across repositories in this org and is run by a
3535

3636
1. Create a tag, e.g. v2.1.0, and push it to the GitHub repo.
3737
1. The [release-drafter.yml](.github/workflows/release-drafter.yml) will be automatically kicked off and is responsible for drafting a new release on GitHub.
38-
1. Before creating a draft release, this workflow creates a GitHub issue asking for approval from the [maintainers](MAINTAINERS.md). See sample [issue](https://github.com/gaiksaya/opensearch-js/issues/1). The maintainers need to approve in order to continue the workflow run.
39-
1. This draft release triggers the [jenkins release workflow](https://build.ci.opensearch.org/job/opensearch-js-release/) as a result of which opensearch-js client is released on [npmjs](https://www.npmjs.com/package/@opensearch-project/opensearch).
40-
1. Once the above release workflow is successful, the drafted release on GitHub is published automatically.
38+
1. Before creating a release, this workflow creates a GitHub issue asking for approval from the [maintainers](MAINTAINERS.md). See sample [issue](https://github.com/gaiksaya/opensearch-js/issues/1). The maintainers need to approve in order to continue the workflow run.
39+
1. Since the repo is already added as part of NPM trusted publisher, `npm publish` with npm version v11.5.1 or above will directly authenticate the workflow and publish to NPM.
40+
1. Once the above release workflow is successful, the release on GitHub is published automatically.
4141
1. Increment "version" in package.json to the next patch release, e.g. v2.1.1. See [example](https://github.com/opensearch-project/opensearch-js/pull/318)

jenkins/release.JenkinsFile

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

0 commit comments

Comments
 (0)