update-npm-version #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-npm-version | |
# https://github.com/forcedotcom/cli/issues/2327 | |
# Customer needs an npm version that has been bundled with node lts | |
# We will install the version that is included with the runner's node | |
on: | |
workflow_dispatch: | |
schedule: | |
# Tuesday 9a central (14 UTC) | |
- cron: '0 14 * * 2' | |
jobs: | |
update-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main | |
- run: | | |
# NOTE: Both @salesforce/plugin-trust and @oclif/plugin-plugins require npm. | |
# In order to ensure that we are not duplicating pinned npm versions | |
# and increasing the CLI bundle size, we get the version from plugin-plugins | |
NPM=$(curl https://raw.githubusercontent.com/oclif/plugin-plugins/main/package.json | jq -r '.dependencies.npm') | |
echo "Current package.json npm version: $(jq '.dependencies.npm' package.json)" | |
echo "Version in @oclif/plugin-plugins: $NPM" | |
yarn add npm@$NPM | |
- uses: salesforcecli/github-workflows/.github/actions/getGithubUserInfo@main | |
id: github-user-info | |
with: | |
SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} | |
- uses: salesforcecli/github-workflows/.github/actions/gitConfig@main | |
with: | |
username: ${{ steps.github-user-info.outputs.username }} | |
email: ${{ steps.github-user-info.outputs.email }} | |
# Push changes if 'git status' is not empty | |
- run: | | |
if [[ -n $(git status --short) ]]; then | |
npm install @salesforce/cli -g | |
yarn build | |
yarn test:nuts | |
git add -A | |
git commit -m "fix: update npm version" | |
git push | |
else | |
echo "Already up to date" | |
fi |