Skip to content

upgrade-node

upgrade-node #482

Workflow file for this run

# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
name: upgrade-node
on:
schedule:
- cron: 13 7 * * *
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
upgrade:
name: Upgrade Node.js
runs-on: ubuntu-latest
permissions:
contents: read
env:
CI: "true"
CHECKPOINT_DISABLE: "1"
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 20.9.0
- name: Install
run: yarn install
- name: Get current Node.js version
id: current_version
run: |-
ENGINES_NODE_VERSION=$(npm pkg get engines.node | tr -d '"')
CURRENT_VERSION=$(cut -d " " -f 2 <<< "$ENGINES_NODE_VERSION")
CURRENT_VERSION_SHORT=$(cut -d "." -f 1 <<< "$CURRENT_VERSION")
echo "CURRENT_NODEJS_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "CURRENT_NODEJS_VERSION_SHORT=$CURRENT_VERSION_SHORT" >> $GITHUB_ENV
echo "value=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "short=$CURRENT_VERSION_SHORT" >> $GITHUB_OUTPUT
- name: Get the earliest supported Node.js version whose EOL date is at least a month away
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |-
const script = require('./scripts/check-node-versions.js')
await script({github, context, core})
- name: Run upgrade script
if: env.CURRENT_NODEJS_VERSION_SHORT < env.NEW_NODEJS_VERSION_SHORT
run: scripts/update-node.sh $NEW_NODEJS_VERSION
- name: Get values for pull request
id: latest_version
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
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c
with:
commit-message: "chore: increase Node.js version to ${{ steps.latest_version.outputs.value }}"
branch: auto/upgrade-node-${{ steps.latest_version.outputs.short }}
base: main
title: "chore: increase Node.js version to ${{ steps.latest_version.outputs.value }}"
body: |-
This PR initiates the upgrade of Node.js from `v${{ steps.current_version.outputs.value }}` to `v${{ steps.latest_version.outputs.value }}`.
Unfortunately, not everything can be automated, and the following steps need to be completed manually:
- [ ] Check if the `RunsUsing` value should be updated [here](https://github.com/hashicorp/terraform-cdk-action/blob/8b74e0c471bd6eb9ea8869f1a73de83b7129717e/.projenrc.ts#L164). Check [here](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions) for supported options.
- Note that the GitHub Actions runners don't automatically support every LTS version - sometimes they skip one.
- [ ] Run `npx projen build`
Please checkout this PR, complete the above steps, push the changes to this branch, and then mark this PR as ready for review to complete the upgrade. Thanks!
labels: automerge,automated,security
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
author: team-tf-cdk <github-team-tf-cdk@hashicorp.com>
committer: team-tf-cdk <github-team-tf-cdk@hashicorp.com>
signoff: true
delete-branch: true
draft: true