Skip to content

Commit e9f7d50

Browse files
authored
Update nodejs.yml
Updated
1 parent 6c28248 commit e9f7d50

File tree

1 file changed

+72
-19
lines changed

1 file changed

+72
-19
lines changed

.github/workflows/nodejs.yml

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,84 @@
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: Node.js CI
1+
name: Workflow App CI/CD
52

63
on:
74
push:
8-
branches: [ "github" ]
5+
branches: [ "main", "development" ]
96
pull_request:
10-
branches: [ "github" ]
7+
branches: [ "main", "development" ]
118

129
jobs:
13-
build:
14-
10+
build-and-test:
1511
runs-on: ubuntu-latest
16-
1712
strategy:
1813
matrix:
1914
node-version: [18.x, 20.x, 22.x]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2115

2216
steps:
23-
- uses: actions/checkout@v4
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
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
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: "npm"
25+
26+
- name: Install Dependencies
27+
run: npm ci
28+
29+
- name: Build the App
30+
run: npm run build --if-present
31+
32+
- name: Run Tests
33+
run: npm test
34+
35+
- name: Upload Build Artifacts
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: build-artifacts
39+
path: dist/
40+
41+
run-shell-scripts:
42+
needs: build-and-test
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Checkout Repository
47+
uses: actions/checkout@v4
48+
49+
- name: Grant Execute Permissions to Shell Scripts
50+
run: chmod +x startup.sh git.sh dev.sh api.sh
51+
52+
- name: Run startup.sh
53+
run: ./startup.sh
54+
55+
- name: Run git.sh
56+
run: ./git.sh
57+
58+
- name: Run dev.sh
59+
run: ./dev.sh
60+
61+
- name: Run api.sh
62+
run: ./api.sh
63+
64+
- name: Upload Logs (if needed)
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: execution-logs
68+
path: logs/
69+
70+
deploy:
71+
needs: run-shell-scripts
72+
runs-on: ubuntu-latest
73+
if: github.ref == 'refs/heads/main'
74+
75+
steps:
76+
- name: Checkout Repository
77+
uses: actions/checkout@v4
78+
79+
- name: Deploy to GitHub Pages
80+
uses: JamesIves/github-pages-deploy-action@v4
81+
with:
82+
branch: gh-pages
83+
folder: dist
84+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)