Skip to content

Upgrade Node.js Version #454

Upgrade Node.js Version

Upgrade Node.js Version #454

---
name: Upgrade Node.js Version
on:
schedule:
- cron: '0 21 * * *' # everyday, 21:00 (UTC)
workflow_dispatch:
jobs:
bump_nodejs_version:
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: setup nodenv
run: |
brew install nodenv
# See: https://github.com/nodenv/node-build#upgrading
brew update && brew upgrade nodenv node-build
- name: install latest nodejs version
run: |
latest_version=$(nodenv install --list | grep -E "^([0-9]+\.){1}[0-9]+(\.[0-9]+)?$" | sort --version-sort --reverse | head -1)
nodenv install $latest_version
nodenv local $latest_version
# https://github.com/actions/setup-node/issues/206#issuecomment-774538395
- uses: nodenv/actions/node-version@main
id: nodenv
- uses: actions/setup-node@v3
with:
node-version: '${{ steps.nodenv.outputs.node-version }}'
- name: install website dependencies, and build
working-directory: website
run: yarn install && yarn build
# See: https://github.com/peter-evans/create-pull-request/tree/master#reference-example
- name: create PR
id: create_pull_request
uses: peter-evans/create-pull-request@v5
with:
# See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs
# See: https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081
token: ${{ secrets.PAT }}
# See: https://github.com/peter-evans/create-pull-request/issues/593
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit-message: '[Scheduled] upgrade nodejs version'
title: '[Scheduled] upgrade nodejs version'
body: |
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
---
See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs
branch: cron_upgrade_nodejs_version
delete-branch: true
labels: |
dependencies
website
# See: https://github.com/peter-evans/create-pull-request/tree/main#auto-merge
- name: enable auto-merge
if: steps.create_pull_request.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.PAT }}
pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }}
merge-method: squash