Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions npm-publish-prerelease/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This action will publish a prerelease version of the package to npm with the spe
* `NPM_TOKEN`: (required) the npm token used to publish the package.
* `GH_TOKEN`: (optional) the GitHub access token to use (default: `${{ github.token }}`).
* `node-version`: (optional) the Node.js version to use for the Action.
* `npm-version`: (optional) the npm version to use for the Action (default: `latest`).
* `NPM_TAG`: (optional) NPM [distribution tag](https://docs.npmjs.com/adding-dist-tags-to-packages) (default: `next`).
* `PROVENANCE`: (optional) set to `true` to generate provenance statement for the published package. Requires the `id-token: write` permission.

Expand Down
10 changes: 10 additions & 0 deletions npm-publish-prerelease/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
description: 'The Node.js version to use in the Action'
required: false
default: 'lts/*'
npm-version:
description: 'The npm version to use in the Action'
required: false
default: 'latest'
PROVENANCE:
description: 'Generate provenance statement for the published package.'
default: 'false'
Expand All @@ -36,6 +40,12 @@ runs:
registry-url: https://registry.npmjs.org/
cache: npm

- name: Setup npm
shell: bash
run: npm install --global "npm@${NPM_VERSION}"
env:
NPM_VERSION: ${{ inputs.npm-version }}

- name: git config
shell: bash
run: |
Expand Down
4 changes: 0 additions & 4 deletions npm-publish-prerelease/bin/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ LOCAL_VERSION=$(node -p "require('./package.json').version")
LOCAL_BRANCH=$(git branch --show-current)
echo "✅ Found ${LOCAL_NAME} ${LOCAL_VERSION} on branch ${LOCAL_BRANCH}"

# Update npm
echo_title "Updating npm to latest version"
npm install -g npm

# If not using Trusted Publishing, validate npm is logged in and ready
if [ "${USE_TRUSTED_PUBLISHING:-}" != "true" ]; then
echo_title "Checking npm auth"
Expand Down
1 change: 1 addition & 0 deletions npm-publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The `npm-prepare-release` action is meant to be called first and will create a p

* `GH_TOKEN`: (required) the GitHub access token to use. It is recommended to use the standard GitHub Actions access token (used in example).
* `node-version`: (optional) the Node.js version to use for the Action.
* `npm-version`: (optional) the npm version to use for the Action (default: `latest`).
* `PROVENANCE`: (optional) set to `true` to generate provenance statement for the published package. Requires the `id-token: write` permission.
* `CONVENTIONAL_COMMITS`: (optional) set to `true` to generate commit messages that follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#specification) specification.
* `SKIP_BUMP_TO_DEV`: (optional) set to `true` to skip bumping to dev version after publishing the release. Might be useful for projects using `nlm`.
Expand Down
10 changes: 10 additions & 0 deletions npm-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: 'The Node.js version to use in the Action'
required: false
default: 'lts/*'
npm-version:
description: 'The npm version to use in the Action'
required: false
default: 'latest'
PROVENANCE:
description: 'Generate provenance statement for the published package.'
default: 'false'
Expand All @@ -42,6 +46,12 @@ runs:
node-version: ${{ inputs.node-version }}
registry-url: https://registry.npmjs.org/

- name: Setup npm
shell: bash
run: npm install --global "npm@${NPM_VERSION}"
env:
NPM_VERSION: ${{ inputs.npm-version }}

- name: git config
shell: bash
run: |
Expand Down
4 changes: 0 additions & 4 deletions npm-publish/bin/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ else
echo "✅ Determined only .json files are changed in PR"
fi

# Update npm
echo_title "Updating npm to latest version"
npm install -g npm

# Determine and validate release type
echo_title "Determining and validating NPM release type"
NPM_VERSION_TYPE=$(echo "$PR_HEAD_REF" | awk -F '/' '{print $2}' | awk -F '-' '{print $1}')
Expand Down