@@ -2,17 +2,20 @@ name: Build and Deploy
2
2
3
3
on :
4
4
push :
5
+ tags :
6
+ - ' v*' # Ensure only tags trigger this workflow
5
7
pull_request :
6
8
branches :
7
9
- main
8
10
workflow_dispatch :
11
+
9
12
jobs :
10
13
build :
11
14
runs-on : ubuntu-latest
12
15
13
16
strategy :
14
17
matrix :
15
- cc : [gcc-12, clang-14] # Use supported versions available in Ubuntu repositories.
18
+ cc : [gcc-12, clang-14] # Supported compilers in Ubuntu repositories.
16
19
17
20
steps :
18
21
- name : Checkout repository
32
35
export CC=clang-14
33
36
export CXX=clang++-14
34
37
fi
35
- # Install CMake
36
- sudo apt-get install -y cmake
38
+ # Install additional dependencies
39
+ sudo apt-get install -y cmake doxygen graphviz
37
40
38
41
- name : Configure with CMake
39
42
run : |
@@ -46,16 +49,54 @@ jobs:
46
49
cd build
47
50
make
48
51
49
- - name : Archive artifacts
50
- run : |
51
- mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time
52
- if [[ -d src/sydevs/core ]]; then
53
- cp src/sydevs/core/*.h artifacts/include/sydevs/core || true
54
- fi
55
- if [[ -d src/sydevs/systems ]]; then
56
- cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true
57
- fi
58
- if [[ -d src/sydevs/time ]]; then
59
- cp src/sydevs/time/*.h artifacts/include/sydevs/time || true
60
- fi
61
- zip -r artifacts.zip artifacts
52
+ - name : Generate Documentation
53
+ if : github.event_name == 'push' || github.ref == 'refs/tags/*'
54
+ run : |
55
+ if [ -f doxygen.config ]; then
56
+ (cat doxygen.config; echo "PROJECT_NUMBER=${{ github.ref_name }}") | doxygen -
57
+ fi
58
+
59
+ - name : Archive Artifacts
60
+ run : |
61
+ # Create artifact directories
62
+ mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time
63
+ # Copy headers
64
+ if [[ -d src/sydevs/core ]]; then
65
+ cp src/sydevs/core/*.h artifacts/include/sydevs/core || true
66
+ fi
67
+ if [[ -d src/sydevs/systems ]]; then
68
+ cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true
69
+ fi
70
+ if [[ -d src/sydevs/time ]]; then
71
+ cp src/sydevs/time/*.h artifacts/include/sydevs/time || true
72
+ fi
73
+ # Copy compiled libraries
74
+ if [[ -d build ]]; then
75
+ cp build/libSyDEVS* artifacts/lib || true
76
+ fi
77
+ mkdir -p $(dirname "SyDEVS-${{ github.ref }}-${{ matrix.cc }}.zip")
78
+ # Create final archive
79
+ zip -r SyDEVS-${{ github.ref }}-${{ matrix.cc }}.zip artifacts
80
+
81
+ - name : Package Documentation
82
+ if : github.event_name == 'push' || github.ref == 'refs/tags/*'
83
+ run : |
84
+ if [ -d doc/html ]; then
85
+ zip -r SyDEVS-${{ github.ref }}_api-reference.zip doc/html
86
+ fi
87
+
88
+ # Step 3: Create GitHub Release for the Compiler
89
+ - name : Create GitHub Release (Compiler-specific)
90
+ uses : svenstaro/upload-release-action@v2
91
+ with :
92
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
93
+ file : SyDEVS-${{ github.ref }}-${{ matrix.cc }}.zip # Unique filename with version and compiler
94
+ asset_name : SyDEVS_Release_${{ github.ref }}-${{ matrix.cc }}.zip # Unique filename with version and compiler
95
+ tag : ${{ github.ref }} # Use tag name as version
96
+ overwrite : false # Prevent overwriting if asset already exists
97
+ body : " Release for SyDEVS version ${{ github.ref }} using compiler ${{ matrix.cc }}"
98
+
99
+ # Step 4: Deploy Documentation
100
+ - name : Deploy Documentation
101
+ if : github.event_name == 'push' || github.ref == 'refs/tags/*'
102
+ run : bash scripts/deploy_docs.sh
0 commit comments