diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..b66f270 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,78 @@ +name: Build for Release + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + strategy: + matrix: + runtime: [win-x64, linux-x64, osx-x64] + include: + - runtime: win-x64 + artifact_path: ./bin/Wpf/Release/net48/win-x64 + self_contained: "--no-self-contained" + framework: net48 + nt_file: nexttrace_windows_amd64.exe + nt_fn: nexttrace.exe + - runtime: linux-x64 + artifact_path: ./bin/Gtk/Release/net6.0/linux-x64 + self_contained: "--self-contained" + framework: net6.0 + nt_file: nexttrace_linux_amd64 + nt_fn: nexttrace + - runtime: osx-x64 + artifact_path: ./bin/Mac64/Release/net6.0/osx-x64 + self_contained: "--self-contained" + framework: net6.0 + nt_file: nexttrace_darwin_amd64 + nt_fn: nexttrace + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6 + + - name: Build + run: dotnet build OpenTrace.csproj --runtime ${{ matrix.runtime }} --configuration Release ${{ matrix.self_contained }} -f ${{ matrix.framework }} + + - name: Fetch Nexttrace Version + run: | + release="${{ github.event.release.body }} " + echo "ntver=$(echo $release | grep -E -o nexttrace_version:.\*? | cut -d':' -f2)" >> $GITHUB_ENV + + - name: Download Nexttrace + uses: robinraju/release-downloader@v1.8 + with: + repository: nxtrace/NTrace-V1 + fileName: ${{ matrix.nt_file }} + latest: ${{ env.ntver == '' && true || false }} + tag: ${{ env.ntver }} + token: ${{ secrets.GITHUB_TOKEN }} + out-file-path: ${{ matrix.artifact_path }} + + - name: Package + run: | + cd ${{ matrix.artifact_path }} + mv ./nexttrace_* ./${{ matrix.nt_fn }} + chmod +x ./${{ matrix.nt_fn }} + tar -cvzf ../../../../../${{ matrix.runtime }}.tar.gz . + + - name: Edit release for ${{ matrix.runtime }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.runtime }}.tar.gz + asset_name: ${{ matrix.runtime }}.tar.gz + tag: ${{ github.ref }} \ No newline at end of file diff --git a/OpenTrace.csproj b/OpenTrace.csproj index b6ddce9..9a19216 100644 --- a/OpenTrace.csproj +++ b/OpenTrace.csproj @@ -32,6 +32,7 @@ +