Skip to content

Commit 9f97c0e

Browse files
authored
Chore: GitHub action workflow for build check (#5)
* GitHub action workflow for build check * Update package.json * Update and rename node.js.yml to build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update package.json
1 parent 8946733 commit 9f97c0e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Build
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Get Node version from package.json
20+
id: get-version
21+
run: echo ::set-output name=node::$(jq -r .engines.node ./package.json)
22+
- name: Print node version
23+
run: echo ${{ steps.get-version.outputs.node }}
24+
- name: Use Node.js ${{ steps.get-version.outputs.node }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ steps.get-version.outputs.node }}
28+
cache: 'yarn'
29+
- run: yarn install
30+
- run: yarn build
31+
# - run: yarn test

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "react-typescript",
33
"version": "0.1.0",
44
"private": true,
5+
"engines": {
6+
"node": "20"
7+
},
58
"dependencies": {
69
"@testing-library/jest-dom": "^5.14.1",
710
"@testing-library/react": "^13.0.0",

0 commit comments

Comments
 (0)