Skip to content

Commit

Permalink
chore(ci): fix logic error in upgrade-node workflow
Browse files Browse the repository at this point in the history
It shouldn't try to "upgrade" to Node 18 if it's already on Node 20.
  • Loading branch information
xiehan authored Aug 9, 2024
1 parent 3b3b11b commit 9b725cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/upgrade-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ jobs:
const script = require('./scripts/check-node-versions.js')
await script({github, context, core})
- name: Update the package with the new minimum Node version and update @types/node
if: env.CURRENT_NODEJS_VERSION_SHORT != env.NEW_NODEJS_VERSION_SHORT
if: env.CURRENT_NODEJS_VERSION_SHORT < env.NEW_NODEJS_VERSION_SHORT
run: |-
npm pkg set engines.node=">= $NEW_NODEJS_VERSION"
yarn add -D @types/node@~$NEW_NODEJS_VERSION_SHORT
- name: Set the new minNodeVersion in the Projen template
if: env.CURRENT_NODEJS_VERSION_SHORT != env.NEW_NODEJS_VERSION_SHORT
if: env.CURRENT_NODEJS_VERSION_SHORT < env.NEW_NODEJS_VERSION_SHORT
run: 'sed -i "s/minNodeVersion: \".*\",/minNodeVersion: \"$NEW_NODEJS_VERSION\",/" ./projenrc.template.js'
- name: Update the Node version used in GitHub Actions workflows
if: env.CURRENT_NODEJS_VERSION_SHORT != env.NEW_NODEJS_VERSION_SHORT
if: env.CURRENT_NODEJS_VERSION_SHORT < env.NEW_NODEJS_VERSION_SHORT
run: 'find ./.github/workflows -type f -name "*.yml" -print0 | xargs -0 sed -i "s/node-version: \".*\"/node-version: \"$NEW_NODEJS_VERSION_SHORT\"/g"'
- name: Get values for pull request
id: latest_version
if: env.CURRENT_NODEJS_VERSION_SHORT != env.NEW_NODEJS_VERSION_SHORT
if: env.CURRENT_NODEJS_VERSION_SHORT < env.NEW_NODEJS_VERSION_SHORT
run: |-
echo "value=$NEW_NODEJS_VERSION" >> $GITHUB_OUTPUT
echo "short=$NEW_NODEJS_VERSION_SHORT" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: env.CURRENT_NODEJS_VERSION_SHORT != env.NEW_NODEJS_VERSION_SHORT
if: env.CURRENT_NODEJS_VERSION_SHORT < env.NEW_NODEJS_VERSION_SHORT
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
commit-message: "chore!: increase minimum supported Node.js version to ${{ steps.latest_version.outputs.short }}"
Expand Down

0 comments on commit 9b725cd

Please sign in to comment.