@@ -3,46 +3,40 @@ name: cpp_tutorial CI and Release
33on :
44 push :
55 branches :
6- - " master" # Trigger workflow on push to master
6+ - " master"
77 tags :
8- - ' v*.*.*' # Trigger workflow on version tags (e.g., v1.0.0)
8+ - ' v*.*.*'
99 pull_request :
1010 branches :
11- - " master" # Trigger workflow on pull request to master
11+ - " master"
1212
1313jobs :
1414 build :
1515 runs-on : ubuntu-22.04
1616
1717 steps :
18- # Step 1: Checkout the repository
1918 - uses : actions/checkout@v3
2019 name : Checkout the repository
2120
22- # Step 2: Build the Docker image
2321 - name : Build the Docker image
2422 run : docker build . --file Dockerfile --tag mycpp_image:latest
2523
26- # Step 3: Configure CMake
2724 - name : Configure CMake
2825 run : docker run --rm -v ${{ github.workspace }}:/cpp_tutorials mycpp_image:latest cmake -S /cpp_tutorials -G "Ninja Multi-Config" -B /cpp_tutorials/build
2926
30- # Step 4: Build with CMake
3127 - name : Build with CMake
3228 run : docker run --rm -v ${{ github.workspace }}:/cpp_tutorials mycpp_image:latest cmake --build /cpp_tutorials/build --config Release
3329
34- # Step 5: Generate Doxygen documentation
35- - name : Generate Doxygen documentation
36- run : docker run --rm -v ${{ github.workspace }}:/cpp_tutorials mycpp_image:latest doxygen /cpp_tutorials/Doxyfile
30+ # List the build directory contents for verification
31+ - name : List build directory contents
32+ run : docker run --rm -v ${{ github.workspace }}:/cpp_tutorials mycpp_image:latest ls -la /cpp_tutorials/build
3733
38- # Step 6: Upload documentation as an artifact
3934 - name : Upload documentation
4035 uses : actions/upload-artifact@v3
4136 with :
4237 name : cpp_documentation
4338 path : /cpp_tutorials/docs
4439
45- # Step 7: Upload build artifacts as an artifact (e.g., binaries or build output)
4640 - name : Upload build artifacts
4741 uses : actions/upload-artifact@v3
4842 with :
@@ -54,39 +48,28 @@ jobs:
5448 runs-on : ubuntu-22.04
5549
5650 steps :
57- # Step 1: Checkout the repository
5851 - uses : actions/checkout@v3
5952 name : Checkout the repository
6053
61- # Step 2: Create a GitHub release
6254 - name : Create Release
6355 id : create_release
6456 uses : actions/create-release@v1
6557 env :
6658 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6759 with :
68- tag_name : ${{ github.ref_name }} # Use the ref_name to get the tag name only
60+ tag_name : ${{ github.ref_name }}
6961 release_name : Release ${{ github.ref_name }}
7062 body : |
7163 Release notes for this version.
7264 draft : false
7365 prerelease : false
7466
75- # Step 3: Upload build artifacts to the release
67+ # Replace '/cpp_tutorials/build/myapp' with the actual build artifact path
7668 - name : Upload build artifacts to release
7769 uses : actions/upload-release-asset@v1
7870 with :
7971 upload_url : ${{ steps.create_release.outputs.upload_url }}
80- asset_path : /cpp_tutorials/build/your_build_artifact # Adjust to your actual artifact
81- asset_name : your_build_artifact_name # Name the artifact file as you want
72+ asset_path : /cpp_tutorials/build/myapp # Adjust to the actual file or artifact path
73+ asset_name : myapp # Adjust this name to what you want
8274 asset_content_type : application/octet-stream
8375
84- # Step 4: Upload documentation to the release
85- - name : Upload documentation to release
86- uses : actions/upload-release-asset@v1
87- with :
88- upload_url : ${{ steps.create_release.outputs.upload_url }}
89- asset_path : /cpp_tutorials/docs
90- asset_name : cpp_documentation
91- asset_content_type : application/zip
92-
0 commit comments