Skip to content

Commit 37d73cc

Browse files
committed
feat: consolidate CI workflows by merging documentation generation into CD pipeline
1 parent 6f2fe6f commit 37d73cc

File tree

2 files changed

+100
-35
lines changed

2 files changed

+100
-35
lines changed

.github/workflows/cd.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
release:
8+
types: [ published ]
9+
10+
jobs:
11+
doxygen-docs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Install Doxygen
18+
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
19+
20+
- name: Generate Documentation
21+
run: doxygen Doxyfile
22+
23+
- name: Upload Documentation Artifacts
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: documentation
27+
path: docs/html/
28+
retention-days: 30
29+
30+
- name: Deploy to GitHub Pages
31+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
32+
uses: peaceiris/actions-gh-pages@v3
33+
with:
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
publish_dir: ./docs/html
36+
force_orphan: true
37+
38+
build-artifacts:
39+
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
build_type: [Release, Debug]
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Install dependencies
48+
run: sudo apt-get update && sudo apt-get install -y cmake gcc
49+
50+
- name: Configure CMake
51+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
52+
53+
- name: Build
54+
run: cmake --build build
55+
56+
- name: Package artifacts
57+
run: |
58+
mkdir -p dist/${{ matrix.build_type }}
59+
cp -r output/* dist/${{ matrix.build_type }}/
60+
cp src/mjsonrpc.h dist/${{ matrix.build_type }}/
61+
cp build/src/libmjsonrpc.a dist/${{ matrix.build_type }}/ || true
62+
63+
- name: Upload build artifacts
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: mjsonrpc-${{ matrix.build_type }}-linux
67+
path: dist/${{ matrix.build_type }}/
68+
retention-days: 7
69+
70+
create-release:
71+
runs-on: ubuntu-latest
72+
if: startsWith(github.ref, 'refs/tags/v')
73+
needs: [doxygen-docs, build-artifacts]
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Download artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
path: artifacts/
82+
83+
- name: Create release packages
84+
run: |
85+
mkdir -p release
86+
cd artifacts
87+
for dir in mjsonrpc-*-linux; do
88+
tar -czf ../release/${dir}.tar.gz ${dir}/
89+
done
90+
cd ..
91+
92+
- name: Create GitHub Release
93+
uses: softprops/action-gh-release@v1
94+
with:
95+
files: release/*
96+
generate_release_notes: true
97+
draft: false
98+
prerelease: false
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docs.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)