-
Notifications
You must be signed in to change notification settings - Fork 6
299 lines (259 loc) · 10.9 KB
/
release.yaml
File metadata and controls
299 lines (259 loc) · 10.9 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
name: Build and Release Executables
# if the tag contains -test- the build is pushed into the build-test branch
# so skunkcrafts does not see it
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Pandoc
run: sudo apt-get update && sudo apt-get install -y pandoc
- name: Create Header
run: |
curl -L https://raw.githubusercontent.com/sindresorhus/github-markdown-css/main/github-markdown.css -o github.css
echo '<style>' > header.html
cat github.css >> header.html
# Force the styles onto the body tag directly
echo 'body { box-sizing: border-box; min-width: 300px; max-width: 980px; margin: 0 auto; padding: 45px; }' >> header.html
echo '@media (max-width: 767px) { body { padding: 15px; } }' >> header.html
echo '</style>' >> header.html
echo '<article class="markdown-body">' > before.html
echo '</article>' > after.html
pandoc README.md \
-f gfm \
-t html \
--embed-resources \
--standalone \
--include-in-header=header.html \
--include-before-body=before.html \
--include-after-body=after.html \
--metadata title="README" \
-o README.html
- name: Upload Documentation Artifact
uses: actions/upload-artifact@v7
with:
name: documentation
path: README.html
build-linux-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# use oldest possible ubuntu version in order to avoid compatibility errors with libc
os: [ubuntu-24.04, macos-15]
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Get XPlane SDK + xplib
shell: bash
run: |
SDK_VERSION=411
curl -L "https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sdk_zip_files/XPSDK${SDK_VERSION}.zip" -o "XPSDK${SDK_VERSION}.zip"
unzip XPSDK${SDK_VERSION}.zip
mv SDK ../
git clone https://github.com/hotbso/xplib.git ../xplib
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build libexpat1-dev gcc-14 g++-14 libgl-dev libopengl-dev libopengl0
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install ninja expat
- name: Configure and build
shell: bash
run: |
TAG=${GITHUB_REF##*/}
if [ -n "$TAG" ]; then
echo "VERSION=$TAG" > version.mak
fi
if [ "$RUNNER_OS" = "Linux" ]; then
export CC=gcc-14
export CXX=g++-14
fi
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF \
-S . -B build
cmake --build build
cmake --install build
tar cvf binary.tar openSAM-pkg/openSAM/*_x64
- name: Upload Build Artifact
uses: actions/upload-artifact@v7
with:
name: build-${{ matrix.os }}
path: binary.tar
build-windows:
runs-on: windows-latest
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-expat
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
unzip
git
- uses: actions/checkout@v6
- name: Get XPlane SDK + xplib
shell: msys2 {0}
run: |
SDK_VERSION=411
curl -L "https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sdk_zip_files/XPSDK${SDK_VERSION}.zip" -o "XPSDK${SDK_VERSION}.zip"
unzip XPSDK${SDK_VERSION}.zip
mv SDK ../
git clone https://github.com/hotbso/xplib.git ../xplib
- name: Build Windows binaries
shell: msys2 {0}
run: |
TAG=${GITHUB_REF##*/}
if [ -n "$TAG" ]; then
echo "VERSION=$TAG" > version.mak
fi
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF \
-S . -B build
cmake --build build
cmake --install build
tar cvf binary.tar openSAM-pkg/openSAM/*_x64
- name: Upload Build Artifact
uses: actions/upload-artifact@v7
with:
name: build-windows
path: binary.tar
release:
runs-on: ubuntu-latest
needs: [docs, build-linux-macos, build-windows]
steps:
- uses: actions/checkout@v6
- name: setup crc32 tool
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libarchive-zip-perl
TAG=${GITHUB_REF##*/}
if [ ! -z "$TAG" ]; then
echo "VERSION=$TAG" > version.mak
fi
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
path: ./build
- name: List artifacts
shell: bash
run: |
pwd
ls -lR ./build
- name: Consolidate platform builds
shell: bash
run: |
pwd
for t in ./build/*/binary.tar
do
tar xvf $t
done
cp ./build/documentation/README.html openSAM-pkg/
cp ./build/documentation/README.html openSAM-pkg/openSAM/
cp ./build/documentation/README.html openSAM-pkg/openSAM_Library/
- name: Prepare Skunkcrafts Updater
shell: bash
run: |
# at this point version.mak should have the version number
source version.mak
OPENSAM_ARTIFACT=openSAM-pkg
RELEASE_FOLDER=release
OPENSAM_FOLDER=$RELEASE_FOLDER/openSAM
OPENSAM_LIBRARY_FOLDER=$RELEASE_FOLDER/openSAM_Library
mkdir -p ${OPENSAM_FOLDER}
mkdir -p ${OPENSAM_FOLDER}/lua
mkdir -p ${OPENSAM_LIBRARY_FOLDER}
echo "=============== RELEASE FOLDER ==============="
cp ${OPENSAM_ARTIFACT}/LICENSE $RELEASE_FOLDER/.
cp ${OPENSAM_ARTIFACT}/README.html $RELEASE_FOLDER/.
cp ${OPENSAM_ARTIFACT}/MisterX-License.jpg $RELEASE_FOLDER/.
echo "=============== OPEN SAM ARTIFACT ==============="
rsync -av ${OPENSAM_ARTIFACT}/openSAM/ ${OPENSAM_FOLDER}/
cp -r openSAM-pkg/lua/* ${OPENSAM_FOLDER}/lua
cp ${OPENSAM_ARTIFACT}/LICENSE ${OPENSAM_FOLDER}/.
cp ${OPENSAM_ARTIFACT}/README.html ${OPENSAM_FOLDER}/.
ls -l ${OPENSAM_FOLDER}
echo
echo "=============== OPEN SAM LIBRARY ARTIFACT ==============="
rsync -av ${OPENSAM_ARTIFACT}/openSAM_Library/ ${OPENSAM_LIBRARY_FOLDER}/
cp ${OPENSAM_ARTIFACT}/LICENSE ${OPENSAM_LIBRARY_FOLDER}/.
cp ${OPENSAM_ARTIFACT}/README.html ${OPENSAM_LIBRARY_FOLDER}/.
ls -l ${OPENSAM_LIBRARY_FOLDER}
## skunkcrafts for openSAM_Library
sed -e "s|@FOLDER_NAME@|${OPENSAM_LIBRARY_FOLDER}|g" \
-e "s|@VERSION@|${VERSION}|g" \
-e "s|@NAME@|Library|g" \
skunkcrafts_updater.cfg.template > "${OPENSAM_LIBRARY_FOLDER}/skunkcrafts_updater.cfg"
sed -e "s|@FOLDER_NAME@|${OPENSAM_LIBRARY_FOLDER}|g" \
-e "s|@VERSION@|${VERSION}|g" \
-e "s|@NAME@|Library|g" \
skunkcrafts_updater_beta.cfg.template > "${OPENSAM_LIBRARY_FOLDER}/skunkcrafts_updater_beta.cfg"
## skunkcrafts for openSAM
sed -e "s|@FOLDER_NAME@|${OPENSAM_FOLDER}|g" \
-e "s|@VERSION@|${VERSION}|g" \
-e "s|@NAME@||g" \
skunkcrafts_updater.cfg.template > "${OPENSAM_FOLDER}/skunkcrafts_updater.cfg"
sed -e "s|@FOLDER_NAME@|${OPENSAM_FOLDER}|g" \
-e "s|@VERSION@|${VERSION}|g" \
-e "s|@NAME@||g" \
skunkcrafts_updater_beta.cfg.template > "${OPENSAM_FOLDER}/skunkcrafts_updater_beta.cfg"
find ${OPENSAM_FOLDER}/ -type f ! \( -name '*skunkcrafts_updater*' -o -path '*skunkcrafts_updater*' \) -print0 | while IFS= read -r -d '' file; do
checksum_hex=$(crc32 "$file")
# Convert hex checksum to uint32 decimal
checksum_decimal=$((16#${checksum_hex}))
# Remove "release/" prefix from $file
modified_file="${file#${OPENSAM_FOLDER}/}"
echo "$modified_file|$checksum_decimal" >> ${OPENSAM_FOLDER}/skunkcrafts_updater_whitelist.txt
# Get file size in bytes
filesize=$(stat -c%s "$file")
echo "$modified_file|$filesize" >> ${OPENSAM_FOLDER}/skunkcrafts_updater_sizeslist.txt
done
find ${OPENSAM_LIBRARY_FOLDER}/ -type f ! \( -name '*skunkcrafts_updater*' -o -path '*skunkcrafts_updater*' \) -print0 | while IFS= read -r -d '' file; do
checksum_hex=$(crc32 "$file")
# Convert hex checksum to uint32 decimal
checksum_decimal=$((16#$checksum_hex))
# Remove "release/" prefix from $file
modified_file="${file#${OPENSAM_LIBRARY_FOLDER}/}"
echo "$modified_file|$checksum_decimal" >> ${OPENSAM_LIBRARY_FOLDER}/skunkcrafts_updater_whitelist.txt
# Get file size in bytes
filesize=$(stat -c%s "$file")
echo "$modified_file|$filesize" >> ${OPENSAM_LIBRARY_FOLDER}/skunkcrafts_updater_sizeslist.txt
done
echo "00_README.txt" > ${OPENSAM_FOLDER}/skunkcrafts_updater_blacklist.txt
echo "00_README.txt" > ${OPENSAM_LIBRARY_FOLDER}/skunkcrafts_updater_blacklist.txt
(cd ${RELEASE_FOLDER} && 7z a "${{ github.workspace }}/openSAM-${VERSION}.zip" *)
TAG=${GITHUB_REF##*/}
TARGET_BRANCH="release"
if [[ $TAG == *"-test-"* ]] # if TAG contains -test-
then
echo "This is a just a build test"
TARGET_BRANCH="build-test"
elif [[ $TAG == *"-"* ]] # if TAG contains -
then
echo "This is a beta release"
TARGET_BRANCH="beta"
fi
git checkout -b ${TARGET_BRANCH}
git config --global user.email "release@opensam.com"
git config --global user.name "GH Release"
git add release/
# force add otherwise ignored directories
git add -f release/openSAM/*_x64/
git commit -m "new ${TARGET_BRANCH} - ${TAG}"
git push -f -u origin ${TARGET_BRANCH}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ github.workspace }}/openSAM*.zip
prerelease: ${{ contains(github.ref_name, '-') }}