File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI/CD Pipeline
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+ branches : [main]
8+ workflow_dispatch :
9+ inputs :
10+ reason :
11+ description : " Reason for manual trigger"
12+ required : false
13+ default : " Test run"
14+ type : string
15+ schedule :
16+ - cron : " 0 0 * * 0"
17+
18+ permissions :
19+ contents : read
20+ pages : write
21+ id-token : write
22+
23+ concurrency :
24+ group : " pages"
25+ cancel-in-progress : false
26+
27+ jobs :
28+ ci :
29+ name : Continuous Integration
30+ runs-on : ubuntu-latest
31+
32+ steps :
33+ - name : Checkout code
34+ uses : actions/checkout@v6
35+
36+ - name : Setup Node.js
37+ uses : actions/setup-node@v6
38+ with :
39+ node-version : " 24"
40+ cache : " npm"
41+
42+ - name : Install dependencies
43+ run : npm ci
44+
45+ - name : Run linter
46+ run : npm run lint
47+
48+ - name : Check formatting
49+ run : npm run format:check
50+
51+ - name : Run tests
52+ run : npm test
53+
54+ - name : Build project
55+ run : npm run build
56+
57+ - name : Generate simple log
58+ run : |
59+ mkdir -p logs
60+ echo "CI Pipeline ran at $(date)" > logs/pipeline.log
61+ echo "Tests passed ✓" >> logs/pipeline.log
62+
63+ - name : Generate demo HTML page
64+ run : |
65+ mkdir -p public
66+ cp demo/index.html public/
67+ cp dist/sum.js public/
68+
69+ - name : Upload build logs artifact
70+ uses : actions/upload-artifact@v6
71+ with :
72+ name : build-logs
73+ path : logs/
74+ retention-days : 30
75+
76+ - name : Upload demo site artifact
77+ uses : actions/upload-artifact@v6
78+ with :
79+ name : demo-site
80+ path : public/
81+ retention-days : 30
82+
83+ deploy :
84+ name : Deploy to GitHub Pages
85+ needs : ci
86+ runs-on : ubuntu-latest
87+
88+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
89+
90+ environment :
91+ name : github-pages
92+ url : ${{ steps.deployment.outputs.page_url }}
93+
94+ steps :
95+ - name : Download artifact
96+ uses : actions/download-artifact@v7
97+ with :
98+ name : demo-site
99+ path : ./public
100+
101+ - name : Upload to GitHub Pages
102+ uses : actions/upload-pages-artifact@v3
103+ with :
104+ path : ./public
105+
106+ - name : Deploy to GitHub Pages
107+ id : deployment
108+ uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments