-
Notifications
You must be signed in to change notification settings - Fork 16
221 lines (192 loc) · 7.53 KB
/
apx-gcs-release.yml
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
name: APX GCS CI
on:
push:
tags:
- "release-*"
- "test-*"
env:
BUILD_DIR: build-release
jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
# if: "false"
container:
image: uavos/apx-gcs-linux:latest
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0
- run: git config --global --add safe.directory `pwd`
# - name: Setup vscode tunnel # https://code.visualstudio.com/docs/remote/tunnels
# run: |
# curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz
# tar -xf vscode_cli.tar.gz
# ./code tunnel --accept-server-license-terms
- name: Build package
run: make release-package
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: |
${{ env.BUILD_DIR }}/deploy/*.AppImage
name: apx-gcs-linux
if-no-files-found: error
retention-days: 1
build-macos:
name: Build MacOS
runs-on: macos-latest
env:
VERSION_QT: 6.8.1
VERSION_SDL: 2.30.8
VERSION_GST: 1.22.5
# we replace system python with brew python
PYTHONPATH: /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0
- run: git config --global --add safe.directory `pwd`
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Install Tools (python)
run: |
pip3 install networkx simplejson jinja2 pyyaml dmgbuild aqtinstall --break-system-packages
- name: Install Qt
working-directory: /tmp
run: |
aqt install-qt mac desktop $VERSION_QT -m \
qtshadertools qt5compat qtcharts qtmultimedia \
qtspeech qtlocation qtpositioning qtserialport
echo "/tmp/$VERSION_QT/macos/bin" >> $GITHUB_PATH
- name: Install SDL
working-directory: /tmp
run: |
curl -L https://github.com/libsdl-org/SDL/releases/download/release-$VERSION_SDL/SDL2-$VERSION_SDL.dmg --output sdl.dmg
hdiutil attach -noverify sdl.dmg
sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/
hdiutil detach /Volumes/SDL2
rm -f sdl.dmg
- name: Install GST
working-directory: /tmp
run: |
curl -L https://gstreamer.freedesktop.org/data/pkg/osx/$VERSION_GST/gstreamer-1.0-$VERSION_GST-universal.pkg --output gst.pkg
curl -L https://gstreamer.freedesktop.org/data/pkg/osx/$VERSION_GST/gstreamer-1.0-devel-$VERSION_GST-universal.pkg --output gst-devel.pkg
sudo installer -package gst.pkg -target /
sudo installer -package gst-devel.pkg -target /
rm -f gst*.pkg
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Install KEYS
env:
KEYCHAIN: default.keychain
KEYCHAIN_PASSWORD: uavos
# base64 -i build_certificate.p12 | pbcopy
SIGNING_CERTIFICATE_P12_DATA: ${{ secrets.SIGNING_CERTIFICATE_P12_DATA }}
SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
CODE_IDENTITY: ${{ secrets.CODE_IDENTITY }}
run: |
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN
security default-keychain -s $KEYCHAIN
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN
security set-keychain-settings $KEYCHAIN
security list-keychains -s $KEYCHAIN
security import <(echo $SIGNING_CERTIFICATE_P12_DATA | base64 --decode) -f pkcs12 -k $KEYCHAIN -P $SIGNING_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN
security -v find-identity -s $CODE_IDENTITY
- name: Build package
env:
CODE_IDENTITY: ${{ secrets.CODE_IDENTITY }}
QT_PATH: /tmp/$VERSION_QT/macos
LD_LIBRARY_PATH: $QT_PATH/lib
PKG_CONFIG_PATH: $QT_PATH/lib/pkgconfig
CMAKE_PREFIX_PATH: $QT_PATH/lib/cmake
run: |
make release-package
- name: Notarize package
env:
NOTARIZATION_API_KEY_ID: ${{ secrets.NOTARIZATION_API_KEY_ID }}
NOTARIZATION_API_KEY: ${{ secrets.NOTARIZATION_API_KEY }}
NOTARIZATION_API_ISSUER: ${{ secrets.NOTARIZATION_API_ISSUER }}
run: |
echo $NOTARIZATION_API_KEY | base64 --decode > notarization_api_key
xcrun notarytool submit ${{ env.BUILD_DIR }}/deploy/*.dmg --key notarization_api_key --key-id $NOTARIZATION_API_KEY_ID --issuer $NOTARIZATION_API_ISSUER --wait
xcrun stapler staple ${{ env.BUILD_DIR }}/deploy/*.dmg
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: |
${{ env.BUILD_DIR }}/deploy/*.dmg
name: apx-gcs-macos
if-no-files-found: error
retention-days: 1
publish:
name: Publish Release
needs: [build-linux, build-macos]
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.ref, 'refs/tags/test-') }}
# if: "false"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: package
- name: Collecting files
id: package
working-directory: package
run: |
find . -mindepth 2 -type f -exec mv -f '{}' . ';'
ls -la *.*
VERSION=${{ github.ref }}
VERSION=$(echo ${VERSION##*/} | sed 's/^release-//')
echo "Version: $VERSION"
echo "::set-output name=path::$(pwd)"
echo "::set-output name=version::$VERSION"
- name: Generate release text
run: |
cp -f docs/releases/release-${{ steps.package.outputs.version }}.md changes.md
sed -i 's/^#/###/g' changes.md
- name: Create Release draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.CI_PAT }}
with:
tag_name: release-${{ steps.package.outputs.version }}
release_name: APX Ground Control ${{ steps.package.outputs.version }}
body_path: changes.md
draft: true
prerelease: true
- name: Publish release
uses: actions/github-script@v7
with:
github-token: ${{secrets.CI_PAT}}
script: |
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
for (let file of await fs.readdir('package', {withFileTypes:true})) {
if (!file.isFile())
continue;
if (file.name.endsWith('.xml'))
continue;
console.log('uploading', file.name);
await github.rest.repos.uploadReleaseAsset({
owner, repo,
release_id: "${{ steps.create_release.outputs.id }}",
name: file.name,
data: await fs.readFile(`package/${file.name}`)
});
}
github.rest.repos.updateRelease({
owner, repo,
release_id: "${{ steps.create_release.outputs.id }}",
draft: false
});