![]() ![]() The setup-node action uses the context as the node-version input. Each version of Node.js specified in the node-version array creates a job that runs the same steps.Įach job can access the value defined in the matrix node-version array using the matrix context. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. The starter workflow includes a matrix strategy that builds and tests your code with four Node.js versions: 10.x, 12.x, 14.x, and 15.x. If you are using a self-hosted runner, you must install Node.js and add it to PATH. Using the setup-node action is the recommended way of using Node.js with GitHub Actions because it ensures consistent behavior across different runners and different versions of Node.js. The setup-node action finds a specific version of Node.js from the tools cache on each runner and adds the necessary binaries to PATH, which persists for the rest of the job. ![]() The setup-node action takes a Node.js version as an input and configures that version on the runner. The easiest way to specify a Node.js version is by using the setup-node action provided by GitHub. For more information, see " Workflow syntax for GitHub Actions." Specifying the Node.js version You can also run jobs in Docker containers, or you can provide a self-hosted runner that runs on your own infrastructure. Or, you can run on the GitHub-hosted macOS runners. For example, you can use the GitHub-hosted Windows runners. You can change the runs-on key to run your jobs on a different operating system. The starter workflow configures jobs to run on Linux, using the GitHub-hosted ubuntu-latest runners. Steps: - uses: - name: Use Node.js $ - run: npm ci - run: npm run build -if-present - run: npm test Running on a different operating system Jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: YAML name: Node.js CI on: push: branches:
0 Comments
Leave a Reply. |