Repository navigation
165 lines (138 loc) · 5.33 KB
/
Copy pathrelease.yml
File metadata and controls
165 lines (138 loc) · 5.33 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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
jobs:
build-native-module:
name: Build Native Module (${{ matrix.artifact-suffix }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- artifact-suffix: linux-x64
arch: x64
os: ubuntu-24.04
- artifact-suffix: linux-arm64
arch: arm64
os: ubuntu-24.04-arm
env:
APP_NAME: 'tinybuf-node'
OSAL_PATH: ${{ github.workspace }}/../osal
ETL_PATH: ${{ github.workspace }}/../etl
steps:
- name: Setup SSH agent
uses: webfactory/ssh-agent@v0.10.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Configure SSH and git
run: |
mkdir -p ~/.ssh
ssh-keyscan -H git.aerospace-lab.de >> ~/.ssh/known_hosts
cat << 'EOF' >> ~/.ssh/config
Host git.aerospace-lab.de
ControlMaster auto
ControlPath ~/.ssh/cm-%r@%h:%p
ControlPersist 10m
ServerAliveInterval 30
EOF
git config --global submodule.fetchJobs 1
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Verify package.json version matches tag
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION=${{ steps.version.outputs.VERSION }}
TAG_VERSION_STRIPPED="${TAG_VERSION#v}"
if [[ "$PACKAGE_VERSION" != "$TAG_VERSION_STRIPPED" ]]; then
echo "::error::package.json version ($PACKAGE_VERSION) does not match tag ($TAG_VERSION_STRIPPED)"
exit 1
fi
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends ninja-build
- name: Clone and build OSAL
run: |
MOCK_APP="${{ github.workspace }}/mock-app"
mkdir -p "$MOCK_APP/src/main/messages" "$MOCK_APP/src/main/cpp/Core"
cp -r "${{ github.workspace }}/src/main/messages/"* "$MOCK_APP/src/main/messages/"
touch "$MOCK_APP/src/main/cpp/Core/ApplicationConfig.hpp"
git clone --recurse-submodules git@git.aerospace-lab.de:rustlet-rt/osal.git "${{ env.OSAL_PATH }}"
export RUSTLET_RT_APPLICATIONS_PATH="${{ github.workspace }}"
export RUSTLET_RT_APPLICATION="mock-app"
cmake -S "${{ env.OSAL_PATH }}" -B "${{ env.OSAL_PATH }}/target/linux/release" -DARCH=linux -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build "${{ env.OSAL_PATH }}/target/linux/release"
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Build native module
run: bunx cmake-js compile
- name: Verify binary architecture
run: file ./build/Release/${{ env.APP_NAME }}.node
- name: Verify no dynamic Poco dependencies
run: |
if ldd ./build/Release/${{ env.APP_NAME }}.node | grep -i poco; then
echo "::error::Binary contains dynamic Poco shared library dependencies!"
exit 1
fi
echo "Verified: no dynamic Poco dependencies!"
- name: Rename artifact
run: mv ./build/Release/${{ env.APP_NAME }}.node ./${{ env.APP_NAME }}-${{ matrix.artifact-suffix }}.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}-${{ matrix.artifact-suffix }}
path: ./${{ env.APP_NAME }}-${{ matrix.artifact-suffix }}.node
if-no-files-found: error
publish-native-module:
name: Publish Native Module
runs-on: ubuntu-24.04
needs:
- build-native-module
env:
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
APP_NAME: 'tinybuf-node'
steps:
- uses: actions/checkout@v7
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Build TypeScript bundle
run: bun run build:ts
- name: Download linux-x64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APP_NAME }}-linux-x64
path: .
- name: Download linux-arm64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APP_NAME }}-linux-arm64
path: .
- name: Publish to registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_REGISTRY_AUTH_TOKEN }}
run: bun publish --registry ${{ env.REGISTRY_URL }} --access public
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: "Tinybuf Node ${{ steps.version.outputs.VERSION }}"
generate_release_notes: true
files: |
${{ env.APP_NAME }}-linux-x64.node
${{ env.APP_NAME }}-linux-arm64.node
draft: false
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}