Skip to content

Commit c58f805

Browse files
authored
ci: fix ci (#7)
1 parent f3b8415 commit c58f805

File tree

2 files changed

+20
-75
lines changed

2 files changed

+20
-75
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ env:
1313
VERSION_MINOR: 1
1414

1515
jobs:
16-
version:
16+
build:
1717
runs-on: ubuntu-latest
18-
outputs:
19-
version: ${{ steps.version.outputs.version }}
20-
build: ${{ steps.version.outputs.build }}
21-
revision: ${{ steps.version.outputs.revision }}
2218
steps:
2319
- name: checkout
2420
uses: actions/checkout@v3
@@ -41,95 +37,42 @@ jobs:
4137
echo " - Build: ${BUILD_NUMBER}"
4238
echo " - Revision (Run Number): ${REVISION}"
4339
44-
build:
45-
needs: version
46-
strategy:
47-
matrix:
48-
include:
49-
- os: windows-latest
50-
platform: windows
51-
- os: ubuntu-latest
52-
platform: linux
53-
54-
runs-on: ${{ matrix.os }}
55-
56-
steps:
57-
- name: checkout
58-
uses: actions/checkout@v5
59-
with:
60-
fetch-depth: 0
61-
6240
- name: setup .NET
6341
uses: actions/setup-dotnet@v5
6442
with:
6543
dotnet-version: 8.0.x
66-
67-
- name: build (Linux)
68-
if: runner.os == 'Linux'
69-
run: |
70-
echo "[+] build linux"
71-
dotnet publish -r linux-x64 --self-contained=true -c Release -p:PublishDir=build /p:Version=${{ needs.version.outputs.version }} /p:FileVersion=${{ needs.version.outputs.version }} /p:AssemblyVersion=${{ needs.version.outputs.version }} /p:ProductVersion=${{ needs.version.outputs.version }}
72-
73-
- name: build (Windows)
74-
if: runner.os == 'Windows'
75-
run: |
76-
echo "[+] build windows"
77-
dotnet publish -r win-x64 --self-contained=true -c Release -p:PublishDir=build /p:Version=${{ needs.version.outputs.version }} /p:FileVersion=${{ needs.version.outputs.version }} /p:AssemblyVersion=${{ needs.version.outputs.version }} /p:ProductVersion=${{ needs.version.outputs.version }}
78-
44+
7945
- name: pack
8046
if: runner.os == 'Linux'
8147
run: |
8248
echo "[+] Packing NuGet package"
83-
dotnet pack --configuration Release -o build -p:PublishDir=build /p:Version=${{ needs.version.outputs.version }} /p:FileVersion=${{ needs.version.outputs.version }} /p:AssemblyVersion=${{ needs.version.outputs.version }} /p:ProductVersion=${{ needs.version.outputs.version }}
84-
85-
- name: collect artifacts
86-
shell: bash
87-
run: |
88-
mkdir -p artifacts
89-
cp build/* artifacts/
90-
ls -lh artifacts
91-
92-
- name: upload artifacts
93-
uses: actions/upload-artifact@v4
94-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
95-
with:
96-
name: ${{ matrix.platform }}-v${{ needs.version.outputs.version }}
97-
path: artifacts/**
98-
99-
release:
100-
needs: [ version , build ]
101-
runs-on: ubuntu-latest
102-
if: github.ref == 'refs/heads/master' && github.ref == 'refs/heads/master' && github.event_name == 'push'
103-
steps:
104-
- name: checkout
105-
uses: actions/checkout@v3
106-
with:
107-
fetch-depth: 0
108-
109-
- name: download artifacts
110-
uses: actions/download-artifact@v4
111-
with:
112-
path: artifacts
113-
merge-multiple: true
49+
dotnet pack --configuration Release -o artifacts -p:PublishDir=artifacts /p:Version=${{ steps.version.outputs.version }} /p:FileVersion=${{ steps.version.outputs.version }} /p:AssemblyVersion=${{ steps.version.outputs.version }} /p:ProductVersion=${{ steps.version.outputs.version }}
11450
11551
- name: create release
52+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
53+
continue-on-error: true
11654
uses: softprops/action-gh-release@v1
11755
with:
118-
tag_name: v${{ needs.version.outputs.version }}
119-
name: release v${{ needs.version.outputs.version }}
56+
tag_name: v${{ steps.version.outputs.version }}
57+
name: release v${{ steps.version.outputs.version }}
12058
generate_release_notes: true
12159
draft: false
12260
prerelease: true
12361
files: artifacts/**
124-
62+
12563
- name: publish to NuGet
64+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
12665
continue-on-error: true
12766
env:
12867
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
12968
run: |
130-
echo "[+] Publishing NuGet packages with version ${{ needs.version.outputs.version }}"
131-
shopt -s globstar nullglob
69+
if [[ -z "${NUGET_AUTH_TOKEN}" ]]; then
70+
echo "[!] NUGET_TOKEN not exists , skip."; exit 0
71+
fi
13272
73+
echo "[+] Publishing NuGet packages with version ${{ steps.version.outputs.version }}"
74+
shopt -s globstar nullglob
75+
13376
for pkg in artifacts/**/*.nupkg; do
13477
if [[ "$pkg" == *.snupkg ]]; then
13578
continue
@@ -139,4 +82,5 @@ jobs:
13982
--api-key "$NUGET_AUTH_TOKEN" \
14083
--source "https://api.nuget.org/v3/index.json" \
14184
--skip-duplicate
142-
done
85+
done
86+

BinaryNinja.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@
2121
<ProductVersion>0.1.0.0</ProductVersion>
2222
<Company>https://github.com/tinysec</Company>
2323
<Product>BinaryNinja</Product>
24-
<Copyright>tinysec©2006-2025</Copyright>
24+
<Copyright>tinysec©2006</Copyright>
2525
<Description>BinaryNinja dotnet bindings</Description>
2626

2727
<!-- NuGet Package properties -->
2828
<PackageId>BinaryNinja</PackageId>
2929
<PackageTags>binaryninja bn bnapi bindings</PackageTags>
3030
<Authors>tinysec</Authors>
31-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
3231
<PackageProjectUrl>https://github.com/tinysec/BinaryNinja</PackageProjectUrl>
3332
<RepositoryUrl>https://github.com/tinysec/BinaryNinja.git</RepositoryUrl>
3433
<RepositoryType>git</RepositoryType>
3534
<PackageReadmeFile>README.md</PackageReadmeFile>
35+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
3636
</PropertyGroup>
3737

38+
3839
<!-- for Windows -->
3940
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
4041
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>

0 commit comments

Comments
 (0)