Skip to content

Commit 76c11d2

Browse files
committed
ci: auto build and attach after release message
1 parent fe82af9 commit 76c11d2

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/build-release.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build for Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
13+
strategy:
14+
matrix:
15+
runtime: [win-x64, linux-x64, osx-x64]
16+
include:
17+
- runtime: win-x64
18+
artifact_path: ./bin/Wpf/Release/net48/win-x64
19+
self_contained: "--no-self-contained"
20+
framework: net48
21+
nt_file: nexttrace_windows_amd64.exe
22+
- runtime: linux-x64
23+
artifact_path: ./bin/Gtk/Release/net6.0/linux-x64
24+
self_contained: "--self-contained"
25+
framework: net6.0
26+
nt_file: nexttrace_linux_amd64
27+
- runtime: osx-x64
28+
artifact_path: ./bin/Mac64/Release/net6.0/osx-x64
29+
self_contained: "--self-contained"
30+
framework: net6.0
31+
nt_file: nexttrace_darwin_amd64
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Setup .NET
40+
uses: actions/setup-dotnet@v3
41+
with:
42+
dotnet-version: 6
43+
44+
- name: Build
45+
run: dotnet build OpenTrace.csproj --runtime ${{ matrix.runtime }} --configuration Release ${{ matrix.self_contained }} -f ${{ matrix.framework }}
46+
47+
- name: Fetch Nexttrace Version
48+
run: |
49+
release="${{ github.event.release.body }} "
50+
echo "ntver=$(echo $release | grep -E -o nexttrace_version:.\*? | cut -d':' -f2)" >> $GITHUB_ENV
51+
52+
- name: Download Nexttrace
53+
uses: robinraju/[email protected]
54+
with:
55+
repository: nxtrace/NTrace-V1
56+
fileName: ${{ matrix.nt_file }}
57+
latest: ${{ env.ntver == '' && true || false }}
58+
tag: ${{ env.ntver }}
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
out-file-path: ${{ matrix.artifact_path }}
61+
62+
- name: Package
63+
run: |
64+
cd ${{ matrix.artifact_path }}
65+
mv ./nexttrace_* ./nexttrace
66+
chmod +x ./nexttrace
67+
tar -cvzf ../../../../../${{ matrix.runtime }}.tar.gz .
68+
69+
- name: Edit release for ${{ matrix.runtime }}
70+
uses: svenstaro/upload-release-action@v2
71+
with:
72+
repo_token: ${{ secrets.GITHUB_TOKEN }}
73+
file: ${{ matrix.runtime }}.tar.gz
74+
asset_name: ${{ matrix.runtime }}.tar.gz
75+
tag: ${{ github.ref }}

OpenTrace.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
3333
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
3434
<PackageReference Include="System.Net.Http" Version="4.3.4" />
35+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.3" />
3536
</ItemGroup>
3637

3738
<ItemGroup>

0 commit comments

Comments
 (0)