File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI/CD - Automated Release
2+
3+ on :
4+ push :
5+ branches :
6+ - main # Or 'master', depending on your default branch name
7+
8+ jobs :
9+ build-and-test :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+
16+ - name : Install CMake and G++
17+ run : |
18+ sudo apt-get update
19+ sudo apt-get install -y cmake g++
20+
21+ - name : Configure CMake
22+ run : cmake -B build_cmake
23+
24+ - name : Build project
25+ run : cmake --build build_cmake
26+
27+ - name : Run tests
28+ # Assuming your CMake project has tests configured with CTest
29+ # If not, replace this with your actual test command (e.g., ./build_cmake/your_test_executable)
30+ run : ctest --test-dir build_cmake --output-on-failure
31+
32+ create-github-release :
33+ needs : build-and-test # This job only runs if build-and-test job succeeds
34+ runs-on : ubuntu-latest
35+ if : success() # Ensure this job only runs if the previous job was successful
36+
37+ steps :
38+ - name : Checkout code
39+ uses : actions/checkout@v4
40+
41+ - name : Get short commit SHA
42+ id : get_sha
43+ run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
44+
45+ - name : Create GitHub Release
46+ uses : actions/create-release@v1
47+ env :
48+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is automatically provided by GitHub Actions
49+ with :
50+ tag_name : release-${{ steps.get_sha.outputs.sha_short }}
51+ release_name : Automated Release - ${{ steps.get_sha.outputs.sha_short }}
52+ body : |
53+ Automated release based on commit: ${{ github.sha }}
54+
55+ This release was automatically generated after all tests passed.
56+ draft : false
57+ prerelease : false
You can’t perform that action at this time.
0 commit comments