-
Notifications
You must be signed in to change notification settings - Fork 13.4k
chore(npm): Update release npm action to stop using tokens #30778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6c5268e
2f6b1cf
b6f35b5
2a548d1
8ea0611
7982930
f422280
c034f37
b81a4d0
8e3a7fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,48 +8,51 @@ inputs: | |
| tag: | ||
| description: 'The tag to publish to on NPM.' | ||
| preid: | ||
| description: 'The prerelease identifier used when doing a prerelease.' | ||
| description: "Prerelease identifier such as 'alpha', 'beta', 'rc', or 'next'. Leave blank to skip prerelease tagging." | ||
| working-directory: | ||
| description: 'The directory of the package.' | ||
| folder: | ||
| default: './' | ||
| description: 'A folder containing a package.json file.' | ||
| token: | ||
| description: 'The NPM authentication token required to publish.' | ||
| node-version: | ||
| description: 'Node.js version to use when publishing.' | ||
| required: false | ||
| default: '24.x' | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - uses: actions/setup-node@v6 | ||
| - name: 🟢 Configure Node for Publish | ||
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | ||
| with: | ||
| node-version: 24.x | ||
| node-version: ${{ inputs.node-version }} | ||
| registry-url: 'https://registry.npmjs.org' | ||
| # Provenance requires npm 9.5.0+ | ||
| - name: Install latest npm | ||
| - name: 📦 Install latest npm | ||
| run: npm install -g npm@latest | ||
| shell: bash | ||
| # This ensures the local version of Lerna is installed | ||
| # and that we do not use the global Lerna version | ||
| - name: Install root dependencies | ||
| - name: 🕸️ Install root dependencies | ||
| run: npm ci | ||
| shell: bash | ||
| - name: Install Dependencies | ||
| - name: 📦 Install Dependencies | ||
| run: npx lerna@5 bootstrap --include-dependencies --scope ${{ inputs.scope }} --ignore-scripts -- --legacy-peer-deps | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| - name: Update Version | ||
| run: npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version --preid=${{ inputs.preid }} | ||
| - name: 🏷️ Set Version | ||
| run: | | ||
| if [ -z "${{ inputs.preid }}" ]; then | ||
| npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version | ||
| else | ||
| npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version --preid=${{ inputs.preid }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this command break if no
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The lerna version guard already handles empty preid: when the workflow passes an empty string, the first branch runs, so no --preid flag is added; any non-empty selection (alpha/beta/etc.) still works through the else branch.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If no errors are thrown then does this new if statement mainly used to run a cleaner command?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct! |
||
| fi | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| - name: Run Build | ||
| - name: 🏗️ Run Build | ||
| run: npm run build | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| - name: Prepare NPM Token | ||
| run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc | ||
| working-directory: ${{ inputs.working-directory }} | ||
| shell: bash | ||
| env: | ||
| NPM_TOKEN: ${{ inputs.token }} | ||
| - name: Publish to NPM | ||
| - name: 🚀 Publish to NPM | ||
| run: npm publish ${{ inputs.folder }} --tag ${{ inputs.tag }} --provenance | ||
gnbm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
Uh oh!
There was an error while loading. Please reload this page.