forked from microsoft/ALAppExtensions
-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (44 loc) · 1.8 KB
/
PublishNuget.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 'Publish Nuget'
on:
workflow_run:
workflows: [' CI/CD']
types: [completed]
branches: ['main']
permissions:
contents: write
packages: write
defaults:
run:
shell: powershell
env:
buildArtifactsPath: ${{ github.workspace }}/.artifacts
packageOutputPath: ${{ github.workspace }}/out
repoName: ${{ github.event.repository.name }}
jobs:
Publish:
if: github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'microsoft'
runs-on: [ windows-latest ]
name: Publish Nuget
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Build Output
env:
GH_TOKEN: ${{ github.token }}
run: |
gh run download ${{ github.event.workflow_run.id }} --pattern '*Apps-*' --dir $env:buildArtifactsPath
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
- name: Prepare Package
run: |
Build/Scripts/Package/PackNuget.ps1 -BuildArtifactsPath $env:buildArtifactsPath -OutputPackageFolder $env:packageOutputPath -RepoName $env:repoName -RepoOwner $env:GITHUB_REPOSITORY_OWNER
- name: Push Package
run: |
$nugetSource = "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
nuget sources add -Name "Github" -Source $nugetSource -Username NotUsed -Password ${{ secrets.GITHUB_TOKEN }}
Get-ChildItem -Path "$($env:packageOutputPath)/*nupkg" | % {
Write-Host "Pushing package $($_.Name) to $nugetSource"
nuget push $($_.FullName) -Source "Github" -ApiKey ${{ secrets.GITHUB_TOKEN }}
Write-Host "Pushing package $($_.Name) to nuget.org"
nuget push $($_.FullName) -Source "https://api.nuget.org/v3/index.json" -ApiKey ${{ secrets.NUGETTOKEN }}
}