Skip to content

Commit 313e3b4

Browse files
committed
GHA: add publish nuget package step for CI
This will publish the package to ease the consumption of it in the client.
1 parent 3e770ab commit 313e3b4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/bcny-firebase.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,26 @@ jobs:
231231
</files>
232232
</package>
233233
"@ | Out-File -Encoding UTF8 firebase.nuspec
234-
nuget pack -Properties BUILDROOT=${{ github.workspace }}\BuildRoot\Library\firebase -Suffix (git log -1 --format=%h) firebase.nuspec
234+
nuget pack -Properties BUILDROOT=${{ github.workspace }}\BuildRoot\Library\firebase -Suffix (git -C ${{ github.workspace }}/SourceCache/firebase-cpp-sdk log -1 --format=%h) firebase.nuspec
235235
shell: pwsh
236236
- uses: actions/upload-artifact@v3
237237
with:
238238
name: windows-${{ matrix.arch }}.nupkg
239239
path: com.google.firebase.windows.${{ matrix.arch }}.*.nupkg
240+
241+
- name: Publish NuGet Packages
242+
env:
243+
NUGET_SOURCE_NAME: TheBrowserCompany
244+
NUGET_SOURCE_URL: https://nuget.pkg.github.com/thebrowsercompany/index.json
245+
NUGET_SOURCE_USERNAME: thebrowsercompany-bot2
246+
NUGET_SOURCE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
247+
NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
248+
run: |
249+
if ((nuget sources List | Select-String "${env:NUGET_SOURCE_NAME}").Count -gt 0) {
250+
nuget sources Remove -Name "${env:NUGET_SOURCE_NAME}"
251+
}
252+
nuget sources Add -Name ${env:NUGET_SOURCE_NAME} -Source ${env:NUGET_SOURCE_URL} -Username ${env:NUGET_SOURCE_USERNAME} -Password ${env:NUGET_SOURCE_PASSWORD} -StorePasswordInClearText
253+
nuget setApiKey ${env:NUGET_API_KEY} -Source ${env:NUGET_SOURCE_URL}
254+
$pkgs = Get-ChildItem -Path com.google.firebase.windows.${{ matrix.arch }}.*.nupkg
255+
nuget push $pkgs[0].Name -Source ${env:NUGET_SOURCE_URL} -SkipDuplicate
256+
shell: pwsh

0 commit comments

Comments
 (0)