Skip to content

Commit 154ddfc

Browse files
committed
[DEVOPS-3949] ci(nuget): use Trusted Publishing auth
1 parent 65d4619 commit 154ddfc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ on:
1010
description: "Dry Run Mode"
1111
required: true
1212
type: boolean
13-
13+
1414
jobs:
1515
deploy:
1616
runs-on: ubuntu-latest
1717
environment: publish
18+
permissions:
19+
id-token: write
1820
steps:
1921
- uses: actions/checkout@v4
2022

@@ -40,10 +42,16 @@ jobs:
4042
- name: Extract Artifacts
4143
run: 7z x nugets.zip -o./nugets
4244

45+
- name: NuGet login (OIDC)
46+
id: nuget-login
47+
uses: NuGet/login@v1
48+
with:
49+
user: ${{ secrets.NUGET_BOT_USERNAME }}
50+
4351
- name: Publish NuGet
4452
if: ${{ inputs.publish_nuget }}
4553
run: |
46-
COMMAND="dotnet nuget push ./nugets/Devolutions.XTS.NET.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
54+
COMMAND="dotnet nuget push ./nugets/Devolutions.XTS.NET.*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
4755
4856
if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
4957
echo "Dry Run : True"
@@ -53,6 +61,6 @@ jobs:
5361
5462
echo "Running : $COMMAND"
5563
56-
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then # if not dry run, actually run the command
64+
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then
5765
eval "$COMMAND"
5866
fi

0 commit comments

Comments
 (0)