Skip to content

Commit e6c6538

Browse files
authored
Ajusta workflow para separar build e empacotamento NuGet (#54)
* Ajusta workflow para separar build e empacotamento NuGet * Ajusta workflow para Trusted Publishing no NuGet.org
1 parent a6528aa commit e6c6538

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/publish.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
permissions:
1212
contents: write
1313
packages: write
14-
14+
id-token: write # required for OIDC token issuance (Trusted Publishing)
15+
1516
steps:
1617
- name: Checkout
1718
uses: actions/checkout@v4
@@ -26,8 +27,11 @@ jobs:
2627
- name: Restore dependencies
2728
run: dotnet restore
2829

29-
- name: Build and create NuGet package
30-
run: dotnet pack DevMaid.CLI/DevMaid.CLI.csproj -c Release --no-restore
30+
- name: Build
31+
run: dotnet build DevMaid.CLI/DevMaid.CLI.csproj -c Release --no-restore
32+
33+
- name: Create NuGet package
34+
run: dotnet pack DevMaid.CLI/DevMaid.CLI.csproj -c Release --no-build --no-restore
3135

3236
- name: Extract version
3337
id: version
@@ -37,10 +41,14 @@ jobs:
3741
echo "version=$version" >> $env:GITHUB_OUTPUT
3842
shell: pwsh
3943

44+
- name: NuGet login (Trusted Publishing)
45+
uses: NuGet/login@v1
46+
id: nuget-login
47+
with:
48+
user: ${{ secrets.NUGET_USER }}
49+
4050
- name: Publish to NuGet.org
41-
run: dotnet nuget push DevMaid.CLI/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
42-
env:
43-
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
51+
run: dotnet nuget push DevMaid.CLI/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
4452

4553
- name: Create GitHub Release
4654
if: github.event_name == 'workflow_dispatch'

0 commit comments

Comments
 (0)