Skip to content

Commit 997b81e

Browse files
authored
chore(ci): Switch to npm trusted publishing (#6152)
1 parent 256e6ae commit 997b81e

File tree

17 files changed

+110
-28
lines changed

17 files changed

+110
-28
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ on:
77
tags: ['v*']
88
paths-ignore:
99
- 'docs/**'
10-
schedule:
11-
- cron: '0 1 * * *'
12-
workflow_dispatch:
10+
workflow_call:
1311
inputs:
1412
canary-release:
1513
description: 'Release canary version (skips tests and checks)'
@@ -136,7 +134,7 @@ jobs:
136134
PR_URL: ${{github.event.pull_request.html_url}}
137135
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
138136
canary-release-pre-check:
139-
if: github.event_name == 'schedule'
137+
if: github.event_name == 'workflow_call' && inputs.canary-release == false
140138
runs-on: ubuntu-latest
141139
outputs:
142140
skip-release: ${{ steps.date-check.outputs.skip-release }}
@@ -169,12 +167,14 @@ jobs:
169167
if: always() && (needs.canary-release-pre-check.outputs.skip-release == 'false' || inputs.canary-release == true)
170168
runs-on: ubuntu-latest
171169
needs: [canary-release-pre-check]
170+
permissions:
171+
id-token: write
172172
steps:
173173
- uses: actions/checkout@v5
174174
- run: git fetch --depth=1
175175
- uses: actions/setup-node@v6
176176
with:
177-
node-version: 22
177+
node-version: 24 # Will install npm 11 needed for trusted publishing
178178
cache: 'yarn'
179179
registry-url: 'https://registry.npmjs.org'
180180
- run: yarn install --frozen-lockfile --ignore-engines
@@ -187,8 +187,6 @@ jobs:
187187
yarn changeset version
188188
yarn changeset pre exit
189189
yarn changeset publish --tag canary
190-
env:
191-
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }}
192190
draft-github-release:
193191
if: startsWith(github.ref, 'refs/tags/v')
194192
runs-on: ubuntu-latest
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow delegates to the appropriate release workflow based on the event that triggered it.
2+
name: release-entry
3+
4+
on:
5+
# Triggers for official releases
6+
release:
7+
types: [published]
8+
# Triggers for canary releases
9+
schedule:
10+
- cron: '0 1 * * *'
11+
12+
workflow_dispatch:
13+
inputs:
14+
canary-release:
15+
description: 'Release canary version (skips tests and checks)'
16+
type: boolean
17+
required: false
18+
default: false
19+
jobs:
20+
delegate_to_release_job:
21+
if: ${{ github.event_name == 'release' }}
22+
uses: ./.github/workflows/release.yml
23+
secrets: inherit
24+
25+
delegate_to_canary_job:
26+
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
27+
uses: ./.github/workflows/build.yml
28+
secrets: inherit
29+
with:
30+
canary-release: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.canary-release || github.event_name != 'schedule' }}

.github/workflows/release.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
name: release
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_call:
65

76
jobs:
87
stable-release:
98
runs-on: ubuntu-latest
9+
permissions:
10+
id-token: write
11+
1012
steps:
1113
- uses: actions/checkout@v5
1214
with:
1315
ref: 'main'
1416
- uses: actions/setup-node@v6
1517
with:
16-
node-version: 22
18+
node-version: 24 # Will install npm 11 needed for trusted publishing
1719
registry-url: 'https://registry.npmjs.org'
1820
- run: yarn install --frozen-lockfile --ignore-engines
1921
- name: Legacy Release
2022
if: startsWith(github.ref, 'refs/tags/v1') || startsWith(github.ref, 'refs/tags/v2') || startsWith(github.ref, 'refs/tags/v3')
2123
run: |
2224
yarn changeset publish --tag legacy
23-
env:
24-
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }}
2525
- name: Latest Release
2626
if: startsWith(github.ref, 'refs/tags/v4')
2727
run: |
2828
yarn changeset publish
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }}
3129
- name: Checkout Docs
3230
uses: actions/checkout@v5
3331
with:

packages/connectivity/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"internal.js",
2424
"internal.d.ts"
2525
],
26-
"repository": "github:SAP/cloud-sdk-js",
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/SAP/cloud-sdk-js.git",
29+
"directory": "packages/connectivity"
30+
},
2731
"scripts": {
2832
"compile": "tsc -b",
2933
"prepublishOnly": "yarn compile && yarn readme",

packages/eslint-config/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
"index.js",
2121
"flat-config.js"
2222
],
23-
"repository": "github:SAP/cloud-sdk-js",
23+
"repository": {
24+
"type": "git",
25+
"url": "https://github.com/SAP/cloud-sdk-js.git",
26+
"directory": "packages/eslint-config"
27+
},
2428
"scripts": {
2529
"readme": "ts-node ../../scripts/replace-common-readme.ts"
2630
},

packages/generator-common/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"internal.js",
2424
"internal.d.ts"
2525
],
26-
"repository": "github:SAP/cloud-sdk-js",
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/SAP/cloud-sdk-js.git",
29+
"directory": "packages/generator-common"
30+
},
2731
"scripts": {
2832
"compile": "tsc -b",
2933
"prepublishOnly": "yarn compile && yarn readme",

packages/generator/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
"internal.d.ts",
2727
"internal.js"
2828
],
29-
"repository": "github:SAP/cloud-sdk-js",
29+
"repository": {
30+
"type": "git",
31+
"url": "https://github.com/SAP/cloud-sdk-js.git",
32+
"directory": "packages/generator"
33+
},
3034
"scripts": {
3135
"compile": "tsc -b",
3236
"prepublishOnly": "yarn compile && yarn readme",

packages/http-client/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"internal.js",
2424
"internal.d.ts"
2525
],
26-
"repository": "github:SAP/cloud-sdk-js",
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/SAP/cloud-sdk-js.git",
29+
"directory": "packages/http-client"
30+
},
2731
"scripts": {
2832
"compile": "tsc -b",
2933
"prepublishOnly": "yarn compile && yarn readme",

packages/odata-common/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"internal.js",
2424
"internal.d.ts"
2525
],
26-
"repository": "github:SAP/cloud-sdk-js",
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/SAP/cloud-sdk-js.git",
29+
"directory": "packages/odata-common"
30+
},
2731
"scripts": {
2832
"compile": "tsc -b",
2933
"prepublishOnly": "yarn compile && yarn readme",

packages/odata-v2/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"internal.js",
2424
"internal.d.ts"
2525
],
26-
"repository": "github:SAP/cloud-sdk-js",
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/SAP/cloud-sdk-js.git",
29+
"directory": "packages/odata-v2"
30+
},
2731
"scripts": {
2832
"compile": "tsc -b",
2933
"prepublishOnly": "yarn compile && yarn readme",

0 commit comments

Comments
 (0)