forked from Skillfyme06-Nov-Org/GithubActions-NodeJs-Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (41 loc) · 1.31 KB
/
Copy pathMatrix.yml
File metadata and controls
41 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: build nodejs application
on: # multiple triggers when this workflow can run
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
job1:
continue-on-error: true # continue to run the job even if there is an error
strategy:
matrix: # it is like a loop to repeat the stpes on each operating_system value and each artifact name
operating_system: [ubuntu-latest,windows-latest]
artifact_name: [artifact-node-ubuntu,artifact-node-windows]
exclude: # dont execute these combinations
- operating_system: ubuntu-latest
artifact_name: artifact-node-windows
- operating_system: windows-latest
artifact_name: artifact-node-ubuntu
runs-on: ${{ matrix.operating_system }}
steps:
- name: Clone the repo
uses: actions/checkout@v6
- name: Install nodejs
uses: actions/setup-node@v6
with:
node-version: 18
cache: 'npm'
- name: Install node dependencies
run: npm ci
- name: Execute test cases
run: npm test
- name: Build the nodejs code
run: npm run build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }} # we need to add a variable which changes as per the OS
path: dist/