Skip to content

Commit 7ade242

Browse files
authored
Convert to library (#1)
1 parent a879ecd commit 7ade242

File tree

16 files changed

+912
-746
lines changed

16 files changed

+912
-746
lines changed

.github/workflows/build.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Rust Build and Release
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
push:
7+
tags:
8+
- 'v*.*.*'
9+
10+
jobs:
11+
validate_build:
12+
name: Validate Build
13+
runs-on: windows-latest
14+
strategy:
15+
matrix:
16+
config: [ debug, release ]
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Build ${{ matrix.config }}
25+
shell: pwsh
26+
run: |
27+
if ("${{ matrix.config }}" -eq "release") {
28+
cargo install cbindgen
29+
cbindgen --config cbindgen.toml --crate navkit-rpkg-lib --output navkit-rpkg-lib.h
30+
cargo build --release
31+
New-Item -ItemType Directory -Force -Path build/x64-release
32+
Copy-Item target/release/navkit_rpkg_lib.dll build/x64-release/
33+
Copy-Item target/release/navkit_rpkg_lib.dll.lib build/x64-release/
34+
Copy-Item navkit-rpkg-lib.h build/x64-release/
35+
} else {
36+
cargo build
37+
}
38+
39+
- name: Upload Release Build Artifact
40+
if: matrix.config == 'release'
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: navkit-rpkg-lib
44+
path: build/x64-release/
45+
46+
create_release:
47+
name: Create Release with Library files
48+
runs-on: windows-latest
49+
if: startsWith(github.ref, 'refs/tags/v')
50+
needs: validate_build
51+
52+
permissions:
53+
contents: write
54+
55+
steps:
56+
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
with:
60+
submodules: recursive
61+
62+
- name: Download Release Build Artifact
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: navkit-rpkg-lib
66+
path: build/x64-release/
67+
68+
- name: List Files
69+
shell: pwsh
70+
run: |
71+
Get-ChildItem -Path build/x64-release/
72+
73+
- name: Upload library files to GitHub Release
74+
uses: svenstaro/upload-release-action@v2
75+
with:
76+
repo_token: ${{ secrets.GITHUB_TOKEN }}
77+
file: build/x64-release/*
78+
file_glob: true
79+
tag: ${{ github.ref }}
80+
overwrite: true

0 commit comments

Comments
 (0)