Skip to content

Commit 5406f21

Browse files
committed
[DEVOPS-3949] ci(nuget): use Trusted Publishing auth
1 parent a2ea6df commit 5406f21

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ 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

@@ -42,10 +44,16 @@ jobs:
4244
run: |
4345
7z x nugets.zip -o./nugets
4446
47+
- name: NuGet login (OIDC)
48+
id: nuget-login
49+
uses: NuGet/login@v1
50+
with:
51+
user: ${{ secrets.NUGET_BOT_USERNAME }}
52+
4553
- name: Publish NuGet
4654
if: ${{ inputs.publish_nuget }}
4755
run: |
48-
COMMAND="dotnet nuget push ./nugets/Devolutions.BCryptPbkdf.Net.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
56+
COMMAND="dotnet nuget push ./nugets/Devolutions.BCryptPbkdf.Net.*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json"
4957
5058
if [ '${{ inputs.publish_dry_run }}' == 'true' ]; then
5159
echo "Dry Run : True"
@@ -55,6 +63,6 @@ jobs:
5563
5664
echo "Running : $COMMAND"
5765
58-
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then # if not dry run, actually run the command
66+
if [ "${{ inputs.publish_dry_run }}" != "true" ]; then
5967
eval "$COMMAND"
6068
fi

0 commit comments

Comments
 (0)