Build Next.js Application

name: Build Next.js Application
repoFullName: Default Repository
on:
  push:
    branches:
      - Default Branch
jobs:
  run-deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: $\{env.workDir}
    matrix:
      node-version:
        - 18.16.0
    steps:
      - uses: actions/checkout@v3
        name: Setup jobs
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v3
        name: Setup environment
        with:
          node-version:
      - name: Install dependencies
        run: npm install --global yarn && yarn
      - name: Building
        run: yarn run build

Explanation:

name: Build Next.js Application

This line sets the name of the GitHub Actions workflow. In this case, it’s named “Build Next.js Application”.

repoFullName: Default Repository

This line specifies the full name of the repository where the workflow will be applied. It’s set to “Default Repository”.

on:  push:  branches:  - Default Branch

This section defines when the workflow should be triggered. In this case, it triggers the workflow when there is a push event to the “Default Branch”.

jobs:  run-deploy:

Defines a job named “run-deploy”. A job is a set of steps that execute on the same runner.

 runs-on: ubuntu-latest

Specifies that the job will run on a virtual machine with the latest version of Ubuntu.

 defaults:  run:  working-directory:

Defines defaults for the run section of steps. In this case, no specific working directory is specified.

 matrix:  node-version:  - 18.16.0

Defines a strategy for the job, creating a matrix of configurations. In this case, it specifies a matrix with a single configuration for the node version, set to “18.16.0”.

 steps:  - uses: actions/checkout@v3  name: Setup jobs  with:  fetch-depth: 0

Checks out the repository at the specified version (v3), and sets up the job with a fetch depth of 0, meaning the entire commit history will be fetched.

 - uses: actions/setup-node@v3  name: Setup environment  with:  node-version:

Sets up the Node.js environment using the setup-node action (v3). The version of Node.js is not specified, so it will use the default version.

 - name: Install dependencies  run: npm install --global yarn && yarn

Installs dependencies using npm, installs yarn globally, and then installs project dependencies using yarn.

 - name: Building  run: yarn run build

Runs the build script defined in the project’s package.json file using yarn.