-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (159 loc) · 6.64 KB
/
release.yml
File metadata and controls
184 lines (159 loc) · 6.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Release
on:
push:
branches: [main]
jobs:
# ── Step 1: Check if the version in CMakeLists.txt is new ───────────────────
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
should_release: ${{ steps.tag_check.outputs.should_release }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from CMakeLists.txt
id: version
run: |
VERSION=$(grep -oP '(?<=project\(Convoy VERSION )\d+\.\d+\.\d+' CMakeLists.txt)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
- name: Check if tag already exists
id: tag_check
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "Tag v${{ steps.version.outputs.version }} already exists — skipping release."
echo "should_release=false" >> $GITHUB_OUTPUT
else
echo "New version v${{ steps.version.outputs.version }} — will create release."
echo "should_release=true" >> $GITHUB_OUTPUT
fi
# ── Step 2: Build full graphics executable on both platforms ────────────────
build-release:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
name: Build ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "Windows"
os: windows-latest
artifact_name: convoy-windows-x86_64
artifact_ext: zip
- name: "Linux"
os: ubuntu-latest
artifact_name: convoy-linux-x86_64
artifact_ext: tar.gz
steps:
- uses: actions/checkout@v4
# ── Windows: GLFW via vcpkg (static-md = static libs + dynamic CRT) ─────
- name: Bootstrap vcpkg (Windows)
if: runner.os == 'Windows'
run: |
if [ ! -d "C:/vcpkg/.git" ]; then
git clone --depth=1 https://github.com/microsoft/vcpkg.git C:/vcpkg
fi
C:/vcpkg/bootstrap-vcpkg.bat -disableMetrics
shell: bash
- name: Cache vcpkg packages (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: C:/vcpkg/installed
key: vcpkg-windows-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-windows-
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md
shell: bash
# ── Linux: build GLFW 3.4 from source (Ubuntu apt ships 3.3.x) ──────────
- name: Install build dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libgl1-mesa-dev xorg-dev wget unzip
- name: Build and install GLFW 3.4 from source (Linux)
if: runner.os == 'Linux'
run: |
wget -q https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip
unzip -q glfw-3.4.zip
cmake -B glfw-build -S glfw-3.4 \
-DGLFW_BUILD_DOCS=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_WAYLAND=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build glfw-build
sudo cmake --install glfw-build
rm -rf glfw-3.4 glfw-3.4.zip glfw-build
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
# ── Build ────────────────────────────────────────────────────────────────
- name: Build
run: cmake --build build --config Release
# ── Verify convoy executable was produced ────────────────────────────────
- name: Verify executable (Windows)
if: runner.os == 'Windows'
run: test -f build/Release/convoy.exe
shell: bash
- name: Verify executable (Linux)
if: runner.os == 'Linux'
run: test -f build/convoy
# ── Package ──────────────────────────────────────────────────────────────
- name: Package (Windows)
if: runner.os == 'Windows'
run: |
mkdir dist
cp build/Release/convoy.exe dist/
7z a convoy-windows-x86_64.zip ./dist/convoy.exe
shell: bash
- name: Package (Linux)
if: runner.os == 'Linux'
run: |
mkdir dist
cp build/convoy dist/
tar -czf convoy-linux-x86_64.tar.gz -C dist convoy
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact_name }}
path: ${{ matrix.config.artifact_name }}.${{ matrix.config.artifact_ext }}
# ── Step 3: Create git tag and GitHub Release ────────────────────────────────
create-release:
needs: [check-version, build-release]
if: needs.check-version.outputs.should_release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ needs.check-version.outputs.version }}"
git push origin "v${{ needs.check-version.outputs.version }}"
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-version.outputs.version }}
name: Convoy v${{ needs.check-version.outputs.version }}
generate_release_notes: true
files: |
artifacts/convoy-windows-x86_64/convoy-windows-x86_64.zip
artifacts/convoy-linux-x86_64/convoy-linux-x86_64.tar.gz