Skip to content

GHA: publish nuget packages to the GitHub Nuget Store #28

GHA: publish nuget packages to the GitHub Nuget Store

GHA: publish nuget packages to the GitHub Nuget Store #28

Workflow file for this run

name: BCNY CI
on:
workflow_dispatch:
pull_request:
branches:
- master
jobs:
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: 'AMD64'
platform: 'x64'
- arch: 'ARM64'
platform: 'ARM64'
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: amd64
arch: ${{ matrix.arch }}
- name: Build Workaround
run: |
git config --global user.email "[email protected]"
git config --global user.name "Arc Builder"
git fetch origin pull/92/head
git cherry-pick FETCH_HEAD
git fetch origin pull/93/head
git cherry-pick FETCH_HEAD
working-directory: external/crashpad
- name: Configure Sentry
run: >
cmake -B out `
-D CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0.19041.0 `
-G "Visual Studio 17 2022" `
-A ${{ matrix.platform }} `
-D CMAKE_SYSTEM_NAME=Windows `
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }}
- name: Build Sentry
run: cmake --build out --config RelWithDebInfo
- name: Stage Sentry
run: cmake --install out --config RelWithDebInfo --prefix sentry-native-development/usr
- uses: actions/upload-artifact@v3
with:
name: sentry-native-windows-${{ matrix.arch }}
path: sentry-native-development
- name: Package Sentry
run: |
$suffix = "${{ matrix.arch }}".ToLower()
@"
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>io.sentry.sentry-native.win.crashpad.$suffix</id>
<version>0.0.0.0</version>
<title>Sentry Native SDK</title>
<description>C++ Sentry Native SDK</description>
<authors>Functional Software, Inc.</authors>
<projectUrl>https://github.com/getsentry/sentry-native</projectUrl>
<repository type="git" url="https://github.com/getsentry/sentry-native" branch="main" />
</metadata>
<files>
<file src="`$DESTDIR`$\bin\crashpad_handler.exe" target="bin" />
<file src="`$DESTDIR`$\bin\crashpad_handler.pdb" target="bin" />
<file src="`$DESTDIR`$\bin\crashpad_wer.dll" target="bin" />
<file src="`$DESTDIR`$\bin\crashpad_wer.pdb" target="bin" />
<file src="`$DESTDIR`$\bin\sentry.dll" target="bin" />
<file src="`$DESTDIR`$\bin\sentry.pdb" target="bin" />
<file src="`$DESTDIR`$\lib\sentry.lib" target="lib" />
<file src="`$DESTDIR`$\include\sentry.h" target="include" />
</files>
</package>
"@ | Out-File -Encoding UTF8 sentry.nuspec
nuget pack -Properties DESTDIR=sentry-native-development\usr -Suffix (git log -1 --format=%h) sentry.nuspec
shell: pwsh
- uses: actions/upload-artifact@v3
with:
name: windows-${{ matrix.arch }}.nupkg
path: io.sentry.sentry-native.win.crashpad.*.nupkg
- name: Publish NuGet Packages
env:
NUGET_SOURCE_NAME: TheBrowserCompany
NUGET_SOURCE_URL: https://nuget.pkg.github.com/thebrowsercompany/index.json
NUGET_SOURCE_USERNAME: thebrowsercompany-bot2
NUGET_SOURCE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
run: |
if ((nuget sources List | Select-String "${env:NUGET_SOURCE_NAME}").Count -gt 0) {
nuget sources Remove -Name "${env:NUGET_SOURCE_NAME}"
}
nuget sources Add -Name ${env:NUGET_SOURCE_NAME} -Source ${env:NUGET_SOURCE_URL} -Username ${env:NUGET_SOURCE_USERNAME} -Password ${env:NUGET_SOURCE_PASSWORD} -StorePasswordInClearText
nuget setApiKey ${env:NUGET_API_KEY} -Source ${env:NUGET_SOURCE_URL}
$pkgs = Get-ChildItem -Path io.sentry.win.crashpad.*.nupkg
nuget push @pkgs -Source ${env:NUGET_SOURCE_URL} -SkipDuplicate
shell: pwsh