Skip to content

Commit 5bd6d4a

Browse files
chore: Remove NPM_TOKEN and migrate to GitHub Packages exclusively
Remove all NPM_TOKEN references from workflows and actions, as the package now publishes exclusively to GitHub Packages using GITHUB_TOKEN with packages:write permission. Changes: - Remove NPM_TOKEN input from npm-install action - Remove NPM_TOKEN input and environment variable from semantic-release action - Remove NPM_TOKEN from on-call-lint-test-build workflow - Add packages:write permission to publish workflow - Update README with GitHub Packages installation instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 041f00d commit 5bd6d4a

File tree

5 files changed

+30
-25
lines changed

5 files changed

+30
-25
lines changed

.github/actions/npm-install/action.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
name: Install NPM packages
2-
description: Adds NPM token and install node modules
3-
4-
inputs:
5-
NPM_TOKEN:
6-
description: NPM token
7-
required: false
2+
description: Install node modules
83

94
runs:
105
using: composite
116
steps:
12-
- name: Add NPM token to .npmrc
13-
if: inputs.NPM_TOKEN != ''
14-
shell: bash
15-
run: |
16-
if [[ -f .npmrc ]]; then
17-
export NPM_TOKEN=${{ inputs.NPM_TOKEN }}
18-
else
19-
echo "//registry.npmjs.org/:_authToken=${{ inputs.NPM_TOKEN }}" > .npmrc
20-
fi
21-
227
- name: Install dependencies
238
shell: bash
249
run: |

.github/actions/semantic-release/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ inputs:
2828
GITHUB_TOKEN:
2929
description: Github token with write permission
3030
required: true
31-
NPM_TOKEN:
32-
description: Secret NPM token
33-
required: false
3431

3532
outputs:
3633
isReleased:
@@ -143,7 +140,6 @@ runs:
143140
${{ env.EXTRA_PLUGINS }}
144141
env:
145142
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
146-
NPM_TOKEN: ${{ inputs.NPM_TOKEN }}
147143
HUSKY: '0'
148144

149145
- name: Output commit hash

.github/workflows/on-call-lint-test-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: ./.github/actions/npm-install
17-
with:
18-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1917

2018
- name: Lint
2119
run: npm run lint && npm run lint:ts

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release and Publish
22

33
on:
44
push:
5-
branches: main
5+
branches: [main]
66

77
jobs:
88
lint-test-build:
@@ -13,16 +13,16 @@ jobs:
1313
shouldUploadArtifact: true
1414

1515
release:
16-
name: Publish to NPM 🚀
16+
name: Publish to GitHub Packages 🚀
1717
runs-on: ubuntu-latest
1818
needs: lint-test-build
1919
permissions:
2020
id-token: write
2121
contents: write
22+
packages: write
2223
steps:
2324
- name: Semantic Release
2425
uses: cloudbeds/webpack-module-federation-types-plugin/.github/actions/semantic-release@main
2526
with:
2627
publishToNpm: true
2728
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,32 @@ All paths can be customized to meet your environment.
1111

1212
## Installation
1313

14+
This package is published to GitHub Packages. To install it, you need to configure npm to use GitHub Packages registry for the `@cloudbeds` scope.
15+
16+
### Configure npm for GitHub Packages
17+
18+
**Option 1: Using `.npmrc` file**
19+
20+
Create or update your `.npmrc` file in your project root or home directory:
21+
22+
```sh
23+
@cloudbeds:registry=https://npm.pkg.github.com
24+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
25+
```
26+
27+
Replace `${GITHUB_TOKEN}` with your GitHub personal access token that has `read:packages` permission, or set it as an environment variable.
28+
29+
**Option 2: Using npm config commands**
30+
31+
```sh
32+
npm config set @cloudbeds:registry https://npm.pkg.github.com
33+
npm config set //npm.pkg.github.com/:_authToken YOUR_GITHUB_TOKEN
34+
```
35+
36+
Replace `YOUR_GITHUB_TOKEN` with your GitHub personal access token that has `read:packages` permission.
37+
38+
### Install the package
39+
1440
```sh
1541
npm i @cloudbeds/webpack-module-federation-types-plugin
1642
```

0 commit comments

Comments
 (0)