11name : CI/CD Pipeline
22
3- # Trigger CI on pushes to main and pull requests
43on :
54 push :
65 branches :
4342 run : |
4443 mkdir -p logs
4544 echo "CI Pipeline ran at $(date)" > logs/ci-pipeline.log
46- echo "Tests passed" > logs/ci-pipeline.log
45+ echo "Tests passed" >> logs/ci-pipeline.log
4746
48- - name : Generate demp HTML page
47+ - name : Generate demo HTML page
4948 run : |
5049 mkdir -p public
5150 cp demo/index.html public/
@@ -65,30 +64,28 @@ jobs:
6564 path : public/
6665 retention-days : 30
6766
68- deploy :
69- name : Deploy to Github pages
70- needs : ci
71- runs-on : ubuntu-latest
72-
73- # Only deploy on push to main branch
74- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
75-
76- environment :
77- name : github-pages
78- url : ${{ steps.deployment.outputs.page_url }}
79-
80- steps :
81- - name : Download artifact
82- uses : actions/download-artifact@v7
83- with :
84- name : demo-site
85- path : ./public
86-
87- - name : Upload to Github Pages
88- uses : actions/upload-pages-artifact@v3
89- with :
90- path : ./public
91-
92- - name : Deploy to Github Pages
93- id : deployment
94- uses : actions/deploy-pages@v4
67+ deploy :
68+ name : Deploy to GitHub Pages
69+ needs : ci
70+ runs-on : ubuntu-latest
71+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
72+
73+ environment :
74+ name : github-pages
75+ url : ${{ steps.deployment.outputs.page_url }}
76+
77+ steps :
78+ - name : Download artifact
79+ uses : actions/download-artifact@v7
80+ with :
81+ name : demo-site
82+ path : ./public
83+
84+ - name : Upload to GitHub Pages
85+ uses : actions/upload-pages-artifact@v3
86+ with :
87+ path : ./public
88+
89+ - name : Deploy to GitHub Pages
90+ id : deployment
91+ uses : actions/deploy-pages@v4
0 commit comments