File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Manually Publish Package to NuGet"
2+
3+ # This workflow is intended for populating the initial NuGet package.
4+ on :
5+ # Allows you to run this workflow manually from the Actions tab
6+ workflow_dispatch :
7+
8+ permissions :
9+ contents : read
10+ concurrency : ${{ github.workflow }}-${{ github.ref }}
11+
12+ env :
13+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
14+ DOTNET_NOLOGO : true
15+ NuGetDirectory : ${{ github.workspace }}/nuget
16+
17+ jobs :
18+ manual-build-and-publish :
19+ runs-on : ubuntu-latest
20+ steps :
21+ - uses : actions/checkout@v5
22+ with :
23+ fetch-depth : 0 # Get all history for automatic versioning
24+
25+ - name : Setup dotnet
26+ uses : actions/setup-dotnet@v4
27+ with :
28+ dotnet-version : " 8.0.x"
29+
30+ - name : Restore dependencies
31+ run : dotnet restore
32+
33+ - name : Build
34+ run : dotnet build --configuration Release --no-restore
35+
36+ - name : Test
37+ run : dotnet test --no-restore --verbosity normal
38+
39+ - name : Get current version
40+ id : current_version
41+ run : |
42+ $currentVersion = (Select-Xml -Path src/OpenPolicyAgent.Ucast.Linq/OpenPolicyAgent.Ucast.Linq.csproj -XPath "//PackageVersion").Node.InnerText
43+ echo "CURRENT_VERSION=$currentVersion" >> $env:GITHUB_OUTPUT
44+ shell : pwsh
45+
46+ - name : Pack
47+ run : dotnet pack --configuration Release --output ${{ env.NuGetDirectory }} --no-build
48+
49+ - name : Publish NuGet package
50+ run : |
51+ foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Filter *.nupkg)) {
52+ dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
53+ }
54+ shell : pwsh
You can’t perform that action at this time.
0 commit comments