Skip to content

Commit 1dc5aa1

Browse files
ErioldDaniel Montoya
andauthored
feat(yml): add yml config (#334)
Co-authored-by: Daniel Montoya <[email protected]>
1 parent 0058e71 commit 1dc5aa1

File tree

3 files changed

+66
-30
lines changed

3 files changed

+66
-30
lines changed

.github/workflows/node.js.yml

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,67 @@
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
1+
name: Node.js CI/CD
32

4-
name: Node.js CI
5-
6-
on:
7-
push:
8-
branches: [ "master" ]
9-
pull_request:
10-
branches: [ "master" ]
3+
on: [push, pull_request]
114

125
jobs:
13-
build:
14-
6+
test:
7+
name: Test
158
runs-on: ubuntu-latest
16-
179
strategy:
1810
matrix:
19-
node-version: [14.x, 16.x, 18.x]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
11+
node-version: [16, 18]
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
22+
- name: Cache npm
23+
uses: actions/cache@v3
24+
with:
25+
path: ~/.npm
26+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-build-${{ env.cache-name }}-
29+
${{ runner.os }}-build-
30+
${{ runner.os }}-
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: ESLint
36+
run: npx eslint .
37+
38+
release:
39+
if: github.ref == 'refs/heads/master'
40+
name: create a version file
41+
runs-on: ubuntu-latest
2142

2243
steps:
23-
- uses: actions/checkout@v3
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm ci
30-
- run: npm run build --if-present
31-
- run: npm test
44+
- name: Checkout code
45+
uses: actions/checkout@v3
46+
47+
- name: Set up Node.js
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: 18
51+
- uses: actions/cache@v3
52+
with:
53+
path: ~/.npm
54+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
55+
restore-keys: |
56+
${{ runner.os }}-build-${{ env.cache-name }}-
57+
${{ runner.os }}-build-
58+
${{ runner.os }}-
59+
60+
- name: Install dependencies
61+
run: npm ci
62+
63+
- name: Semantic Release
64+
run: npx semantic-release
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"semantic-release": "semantic-release"
1111
},
1212
"engines": {
13-
"node": ">=10"
13+
"node": ">=14"
1414
},
1515
"repository": {
1616
"type": "git",

0 commit comments

Comments
 (0)